hello
I've been struggling since earlier for something that looks easy. I'm not very comfortable with remotes, so I don't really know how it works.
I have a script error: 13:56:37.349 - FireClient: player argument must be a Player object
and I'm not sure how to fix it.
here are the two scripts
server script :
value = script.Parent.Value.Value torsop = script.Parent.Parent.Parts.Torsoe head = script.Parent.Parent.Parts.Heade fly = script.Parent.Parent.Parts.SonicFly lefta = script.Parent.Parent["Left Arm"] righta = script.Parent.Parent["Right Arm"] leftl = script.Parent.Parent["Left Leg"] rightl = script.Parent.Parent["Right Leg"] eye1 = script.Parent.Parent.Parts.Eyes1 eye2 = script.Parent.Parent.Parts.Eyes2 ----------------------------------------------------------------------------- local repstorage = game:GetService("ReplicatedStorage") local Remote = repstorage:WaitForChild("Remote") ----------------------------------------------------------------------------- ----------------------------------- BASIC ATTACK ------------------------------- -------------------------- Sonic kills and chase ------------------------------- if value == 0 then -- event choice local active = false -- currently in chase? local found = false -- anyone within range? while wait(2) do found = false -- reset before checking again for i,v in pairs(game.Players:GetChildren()) do local range = (v.Character.HumanoidRootPart.Position - Torso.Position).magnitude -- I changed it to HRP instead of Torso, this exists in all humanoids, Torso is R6 only. if range <= 80 then found = true if not active then active = true -- start chase torsop.Transparency = 1 head.Transparency = 1 righta.Transparency = 1 lefta.Transparency = 1 leftl.Transparency = 1 rightl.Transparency = 1 fly.Transparency = 0 eye1.Transparency = 1 eye2.Transparency = 0 -- char change sonic.WalkSpeed = 29 Remote:FireClient() --------- The problem is here ----------- break -- breaks the for loop end end end if not found then -- the entire for loop ran without finding anyone active = false -- stop chase torsop.Transparency = 0 head.Transparency = 0 righta.Transparency = 0 lefta.Transparency = 0 leftl.Transparency = 0 rightl.Transparency = 0 fly.Transparency = 1 eye1.Transparency = 0 eye2.Transparency = 1 -- char change sonic.WalkSpeed = 18 end end ------------------------------------------------------- end --- end of the script
local script
local repstorage = game:GetService("ReplicatedStorage") local remote = repstorage:WaitForChild("Remote") remote.OnClientEvent:connect(function(player) print(player.Name.."has fired this event") end)
any suggestions ?
Remote:FireClient(v, v.Name) ---[[ just add here "v" (player object). If you didnt do that, the server didnt know what client to fire, so - error]] --- ---[[v.Name - is firing the player.Name ]]--- --[[ Client Script ]]-- local repstorage = game:GetService("ReplicatedStorage") local remote = repstorage:WaitForChild("Remote") --[[playerName is (v.Name) that you fired from server]]-- remote.OnClientEvent:connect(function(playerName) print(playerName.."has fired this event") end)