I am trying to make it so that when a player touches a brick, an event is fired. Instead, it is coming up with “Player Argument must be a Player Object”. The confusing thing is that it fires the event the first time, but if I try to do it again, the error comes up even though it worked before?
Here is the script:
local debounce = false
script.Parent.Touched:connect(function(Part)
if not debounce then
debounce = true
local Player = game.Players:GetPlayerFromCharacter(Part.Parent)
game.ReplicatedStorage.Dialogue.ShopKeeper1:FireClient(Player)
wait(10)
debounce = false
end
end)
I have put a normal script under a part in workspace.