Hello, devs! I am having a bit of an issue with writing a script. What this script does is
sends a remote event to the client for it to check if an animation is playing. It works, but whenever I do it, it keeps saying FireClient: player argument must be a Player object. Here is my script. Thanks for reading!
local debounce = false
local box = game.Workspace.Box
script.Parent.Touched:Connect(function(hit)
if debounce == false then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.CheckAnimation:FireClient(plr)
debounce = true
wait(3)
debounce = false
end
if debounce == true then
print("Player is spamming!")
end
end)
game.ReplicatedStorage.DestroyBox.OnServerEvent:Connect(function(player)
for i, v in pairs(box:GetDescendants()) do
if v.Name == "Part" then
v.Anchored = false
v.CanCollide = false
end
if v.Name == "Part" and v:GetDescendants("SelectionBox") then
v:Destroy()
end
end
end)