How do I get the player from a touched event?
So far I’m doing this:
script.Parent.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
player.InJail = true
end
end)
But I get this error: InJail is not a valid member of Player "Players.iWantBananaNow"
This is the script for creating the "InJail" BoolValue:
game.Players.PlayerAdded:Connect(function(player)
local InJail = Instance.new("BoolValue")
InJail.Name = "InJail"
InJail.Parent = player
end)
Any help appreciated!