For some reason the script isn’t finding the boolean value located inside player, why is this? All scripts shown are normal scripts, no local scripts.
are you sure that hit is a body part of the character? if it touches a tool/accessory Handle part than you’ll need to use hit.Parent.Parent instead etc.
so, print the hit name and see whats happening.
The issue, isn’t that the boolean isn’t being found in the player, but instead, ‘player’, is nil. You can fix this by doing the following, which checks whether or not is Player a thing.
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and game.Players[tostring(plr)] then
-- Do your stuff.
end
end)
2 Likes
There is no reason to check game.Players[tostring(plr)] if you already checked plr.
Honestly, I also thought of that, but… For the sake of being sure, I used it.
Yeah, this fixed it, the hit was reading an accessory. Thanks!
