local event = game.ReplicatedStorage.Events["Enter/ExitCaveEvent"] script.Parent.Touched:Connect(function(player) event:FireClient(player) end)
When it fires server, the output says this
20:06:47.589 - FireClient: player argument must be a Player object
I named everything correct, I don't know why this is happening!!! Can someone help me? Here is the client code
local event = game.ReplicatedStorage.Events["Enter/ExitCaveEvent"] event.OnClientEvent:Connect(function(player) if workspace.CaveStuff.DetectionBrick.ShowEnter == true then workspace.CaveStuff.DetectionBrick.Script.Disabled = true print("Enter") wait(0.5) end if workspace.CaveStuff.DetectionBrick.ShowEnter == false then workspace.CaveStuff.DetectionBrick.Script.Disabled = true print("Exit") end end)
ty NSMascot
You're firing a part instead of a player. Basically, when the part is touched, it gives the part that touched it, not the player. Since the part that touches it is the child of a character, instead of event:FireClient(player)
, you've gotta do event:FireClient(game.Players:GetPlayerFromCharacter(player.Parent))
. By the way you might want to change the variable name from "player" to something else to avoid confusing yourself
touched returns an objectvalue, and fireclient takes a player parameter. U have to specify which player to fire for a fireclient. rn u r firing an object, so roblox is throwing an error