Ad
Log in to vote
0

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

Asked by 1 month 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 6785 — 1mo
0
I need it to be random jackpanda900 26 — 1mo

1 answer

Log in to vote
0
Answered by 1 month 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 6785 — 1mo
Ad

Answer this question