Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont this script Clone any Blocks even tough Output is empty?

What im trying to do here is: I have multiple parts called "Block" in a folder named Obstacles inside Serverstorage. I want the Blocks to be cloned ON TOP of a Part so i made the coordinates. But nothing is happening. I dont know if this will help but what im trying to overall create is a game where the Player stands on a Part that increases Velocity over time and the Cloning blocks are supposed to be obstacles said player has to dodge to not be pushed to a Blackhole

while wait(math.random(10,20)) do 
local a = -275.37 
local b = -268.97
local function randcontinuous(a, b)
local x = game.ServerStorage.Obstacles.Block:Clone()
x.Anchored = false
x.Parent = workspace:WaitForChild("Space",24)
wait (24)
return a + math.random()*(b - a)

end
end

1 answer

✓ Accepted answer

Call the function!

A function won't run if it's not being called, no matter where you put it. Unless it's in a spawn. OR in a delay. OR in a callback.

You know what, you get my point. Just call the function. You can call a function by doing it like this:

FunctionName(ArgumentsHere, ArgumentsAlsoHere, ButWait, ArgumentsCanBeHereToo)

In your case, it would be randcontinuous(a, b).

2 comments

0

If this helped, please upvote and select as answer. Thanks!

0

At what line would i have to put it?

This discussion is preserved as it was. New answers, comments, and votes are closed.