Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make platforms pick a random color and turn off canColide on random?

Asked by 3 years ago

I have tried this,

local test = math.random(1,8)
local platform = "Platform"..test

workspace.Map.platform.canCollide = false

But it wont work. Please help!

0
You can manually set 'CanCollide**' to false, as you have no need to adjust it with your code from the context I'm seeing. Ziffixture 6913 — 3y
0
I need it to be random jackpanda900 26 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Line 4 of your code is the problem because it searches for an Instance named "platform" in game.Workspace.Map. Also the property is typed like this: CanCollide whereas in your code you left the first c lowercased. What you should do is one of these two things:

game.Workspace.Map[platform].CanCollide = false
--or
game.Workspace:FindFirstChild(platform).CanCollide = false
0
Both will rise an error if the allocation evaluates to nil. Ziffixture 6913 — 3y
Ad

Answer this question