Hello! I hope you are having a great New Year! I have a pretty big problem. My leveling door won’t work.
What is causing the issue?
Is it Really nil?
No:
What is the script so I can help?
script.Parent.Touched:Connect(function(plrhit)
local plr = game.Players:GetPlayerFromCharacter(plrhit.Parent)
if plr.LevelsSystem.Level.Value > 30 then
script.Parent.CanCollide = true
wait(3)
script.Parent.CanCollide = false
end
end)
Do I need more info?
Normally, the doors collisions are always off unless a player with not the right level touches the door
This door will let anyone go in it, even if they aren’t level 30.
Check to make sure it is getting the player properly. I usually use plrhit:FindFirstAncestorOfClass("Model") to get the player’s character, since the .Touched parameter’s direct parent won’t always be the character model (for example, it could hit a child of a hat object).
script.Parent.Touched:Connect(function(plrhit)
local plr = game.Players:GetPlayerFromCharacter(plrhit:FindFirstAncestorOfClass("Model"))
if plr then
if plr.LevelsSystem.Level.Value > 30 then
script.Parent.CanCollide = true
wait(3)
script.Parent.CanCollide = false
end
end
end)
But also, may I ask, is this a server or local script? I’m noticing that you are making something uncollidable after having a high enough level, and I have a better solution of doing this.