So basically, I want my local script to randomly decide if a brick is transparent or not from a model. It's not doing that, and it doesn't print anything either, and there are no errors in the output.
Code:
wait() print("i'm here") for i, v in pairs(script.Parent.Rocks:GetChildren()) do if v.Name == "Part" then local fate = math.random(1,2) if fate == 1 then v.Transparency = 0 v.CanCollide = true print("work") elseif fate == 2 then v.Transparency = 1 v.CanCollide = false print("work") end end end
I'm not sure if you've figured this out yet or not, but I'm pretty certain I know the problem. You know filtering enabled? That good old guy that completely destroyed half of Roblox's games when it was forced on all games? Yeah, it makes so local scripts only change things for the local player, so if you were to make a part in a local script, the player that that local script is linked to is the only person that the part appears for.
The issue with your system is that the script isn't being activated like you think it is. For you, it appears to be activated, but your view of the explorer while in a test is a local view, so if something only happens locally, it will still show it in there. The script is only enabling locally, so it's not actually enabling the script, and it's showing that it is in the explorer.
The solution? Put it in a server script, and use another server script to enable the server script. Server scripts change things for all players, and actually affect the place itself, so by using server scripts instead, you can solve your issue.
Now there are some situations where you need certain input information that you can only get from a local script, but you need it to do something in a server script. In a case like this, you would use remote events. If you don't understand what a remote event is, and how it works, watch this video, because that's how I learned it all: https://www.youtube.com/watch?v=4Dc_bri9mjs