Hi ! i have read this script but i want change the CanCollide for a hiden part.
Exemple: if player have more than 30 minutes played on my server, the part become hiden and the player can go on the other side (only for players have 30 minutes, not all), i don't know if it's possible ?
Code:
local parent = script.Parent parent.Touched:Connect(function(other_part) local player = game:GetService("Players"):GetPlayerFromCharacter(other_part.Parent) if not player then return end local leaderstats = player.leaderstats local minutes = leaderstats.Minutes if minutes.Value < 30 then return end parent.CanCollide = false wait(1) parent.CanCollide = true end)
just add transparency
local parent = script.Parent parent.Touched:Connect(function(other_part) local player = game:GetService("Players"):GetPlayerFromCharacter(other_part.Parent) if not player then return end local leaderstats = player.leaderstats local minutes = leaderstats.Minutes if minutes.Value < 30 then return end parent.CanCollide = false parent.Transparency = 1 wait(1) parent.CanCollide = true parent.Transparency = 0 end)
parent.Transparency = 1 ------ invisible parent.Transparency = 0 ------ visible
You could also put it in the replicated storage
parent.Parent = game.ReplicatedStorage
By the way, you are also changing the cancollide to true meaning they can't walk through the part one second after you make its collisions false