I know the Touched event works and fires but the If statements dont work?
The If statements unanchor or anchor a part randomly but this doesnt happen.
script.Parent.Touched:Connect(function(touched)
local baseplate = workspace.Baseplate
local rain = workspace.rain
local stormwinds = workspace.stormwinds
local impact = workspace.impactsource
local chance = math.random(100)
if chance and not baseplate and not rain and not stormwinds and not impact >= 0 then
touched.Anchored = false
elseif chance and not baseplate and not rain and not stormwinds and not impact <= 0 then
touched.Anchored = true
end
end)
No errors in console either (I already know there were gonna be no errors in the console)

15 comments
math.random() should have two parameters filled not one
That doesn't do anything (it still does nothing)
well maybe try separating those two if statements into a bunch of if statements
and if that doesn't work then try doing imapctsource.Value instead of impactsource
impact*
doesn't do anything either
impactsource is a brick not a value, all of the variables are bricks
what do you mean "if not baseplate"??? if the baseplate is nil, your script is going to error at line 2. if its not, it will never get past your if statement
math.random() can take one argument. Stop spreading misinformation, MCAndRobloxUnited.
then how would i get past this (baseplate is in workspace)
It can also take no arguments and if that happens generates a number in the interval [0, 1)
incapaz help pls
As @MCAndRobloxUnited pointed out, you need two parameters, not one, to call math.random, for the random chance generator needs to have a range.
Also, you just said "if chance". If you want a random chance, like I assume you do, you would need something along the lines of "if chance == 100 and..."
No, this script is supposed to unanchor something with 50% chance which is why its "if chance >= 50 then", also math.random can take one, two, and no arguments