#Script that clones a part with specific attributes to the end of a part.

1 messages · Page 1 of 1 (latest)

fringe fiber
#

Trying to make a game about the glitching zones of roblox and I need to be able to generate parts infinitely so that the player can walk on them, the player can naturally tp to the coordinates they want but I still need to figure out how to generate parts infinitely. anyone got help?

carmine axle
#

to generate parts infinitly you do just use

local newpart = part:clone()
#

say you store the original part in replicatedstorage you will need to parent it to the workspace and position it how you see fit

#

but clone() allows for limitless replication

fringe fiber
#

But yk when you need 2 parts to be perfectly aligned

#

How do I do that?

carmine axle
#

ahh i get you

#
local RunService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")

--// create part
local part = Instance.new("Part")
part.Size = Vector3.new(6, 1, 6)
part.Anchored = true
part.CanCollide = true
part.BrickColor = BrickColor.new("Bright red")
part.Parent = workspace

--// define a fixed Y level for the player to walk on
local fixedY = 3 

RunService.Heartbeat:Connect(function()
    if root then
        --// position the block under the player at the fixed Y level
        local pos = root.Position
        part.Position = Vector3.new(pos.X, fixedY, pos.Z)
    end
end)
#

no matter where i walk it will "follow" underneath me

#

of course this means that they cant teleport under the Y level

#

or above or they will just fall

#

so if thats a deal breaker you could quickly calculate the Y level based on their position

fringe fiber
#

And so where will I put this script?

#

And like how do I make it

#

If you just cant tp the part with the y level then its ok

#

Like where should I put the script and should I use a local script or a regular

#

I got it

#

as a fun little gratitude

#

Please watch this @carmine axle

rotund surge
fringe fiber
#

I just put it into StarterPlayer - StarterCharacterScripts

#

and it worked flawlessly

#

I'm kinda making this game only for me. not really for public

rotund surge
#

yes it wont replicate to other clients though

fringe fiber
#

wdym

rotund surge
#

if another player joined they wont see any of the parts

fringe fiber
#

I don't want the player to be able to see the part

#

I want to make an "endless" baseplate and they can "walk" on the baseplate

#

Im gonna make a quick video for you

rotund surge
#

I mean I guess it fits your purpose but in terms of replication maybe not the best

fringe fiber
#

I think its this video

#

yup it is

#

watch the video to see what im talkin about

rotund surge
#

alright, if you are just making a game for you this would work but for later reflection about replication I will show you two images

#

this is what the client sees

#

this is what the server sees

fringe fiber
#

I changed the sript

#

script*

#

to make on y level -1

#

and that way it looks like I'm walking on the floor

#

but for some reason after a while the floor dissapears

#

I used a special mesh to make it "infinite"

#

but I really wanna make it infinite

#

u got anythin for that?

#

Like I wanna make infinite terrain but idk how.

rotund surge
#

like natural terrain generation?

fringe fiber
#

Idk man

#

I want a part to be able to "stretch" infinitely

#

I have a main baseplate that I want to be able to be an infinite size

#

but idk how without it breaking

rotund surge
#

I mean you could increase the size when the player gets near the edge but it would be obvious to the player that you are doing that

fringe fiber
#

still

#

but how do I do it to make it seem like terrain generation but with just a regular part

rotund surge
#

could you explain a little deeper for what exactly you are looking for?

fringe fiber
#

I want to make a game about the roblox's glitching zones like the null zone when you go too far out

#

and it starts glithcing the hell out

rotund surge
#

While the natural generation of terrain is very complicated, you could use math.noise()

fringe fiber
#

explain.

rotund surge
#

you know minecraft?

fringe fiber
#

ye

rotund surge
#

the terrain is generated with a thing called Perlin noise and roblox also has perlin noise which is math.noise()

#

It basically gives you random values that are kinda in some sort of pattern

#

the hardest part with an infinite map is storing all that in ram

#

if you did anything relating to map generation you would have to make something that deletes and stores terrain to a table when the player gets too far

#

or else it isnt going to be infinite because the players game will crash when they walk too far

carmine axle
rotund surge
fringe fiber
#

well alr but how do I do this math.noise() stuff?

carmine axle
#

i dont think terrain gen is required for this

fringe fiber
#

Well then how do I make an infinite map without the players game crashing

carmine axle
#

just spawning a really large part under the player should allow them to go wherever they want

fringe fiber
#

cuz I don't want the player to crash

rotund surge
fringe fiber
#

so I should just make the part big?

carmine axle
#

then you need a service like heartbeat

spawn a big part under them

clean the part up when no longer used

#

it would cost very little performance

fringe fiber
#

wait im gonna test something real quick

carmine axle
#

the script i sent just repositions the same part at your feet

#

so its not hurting performance

fringe fiber
#

I made the part be the max size

#

and it kinda looks like the player is walking on a big map but not really

#

imma do a quick vid

rotund surge
#

yeah the texure will be stationary

#

you could just get rid of the texture

fringe fiber
#

the original map is like 40, 1, 40

#

one sec

#

i gotta speed myself up

carmine axle
#

at a certain point the game breaks fr

#

i have become a triangle

fringe fiber
carmine axle
fringe fiber
#

the y level doesnt need to change

#

for the part

#

unless the playe will be just stuck in the air

#

which isnt all that bad

carmine axle
#

exactly so make it so they get X and Z to change only

#

make Y always 10

#

and they can teleport anywhere and this script will always have a part under them

fringe fiber
#

it will

carmine axle
#

keep in mind a certain distance you will die or the game breaks

fringe fiber
#

I made a textlabel for the player that the middle coordinate has to be atleast 100 so they don't fall through

halcyon sableBOT
#

studio** You are now Level 10! **studio

fringe fiber
#

but again I want to be able to make the map almost infinite

carmine axle
#

yep perfect

carmine axle
fringe fiber
#

Like not even with script?

#

That when a part gets touched the baseplate changes size?

carmine axle
fringe fiber
#

LIke the max is like 2048 or something i think

carmine axle
#

oh you just mean the parts size?

fringe fiber
#

This is what I use to teleport

#

I use these coordinates without the commas and the thing works

carmine axle
fringe fiber
#

wdym

#

Like I cant change the part to 1b studs

#

the max is like 2028

#

in x y z

#

and you cant go over that no matter how hard i try

#

I can use specialmeshes but after a while they dissapear

#

and the textures break if I set them to like 1000

#

And I wanna be able to override the max part size to "infinite"

#

without the players game crashing of course

carmine axle
#

im not sure why you want that for your project though you could have the part 5,5 and the player can still teleport anywhere

the only way to overide the size is with multiple parts
so you would have to tile the parts layer by layer but players wouldnt even be able to see nor get to those parts anyway

fringe fiber
#

well rip

#

still it will only be available for me for now

#

btw

#

anyway I can make a gif into roblox

#

Say like this

#

this is a gif but for here it isnt

#

but I want to be able to use a gif as an animation

#

anway i can do that?

#

this

#

bro..

#

this

#

I want to be able to use this in roblox but idk how

#

you got anything to help me @carmine axle?

carmine axle
fringe fiber
#

well alr