Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

FireClient() error local 12:14:16.314 - FireClient: player argument must be a Player object help??

i made a tool that will change part position, tried to do it with fireserver() but it wont change so i do with FireClient() but i got this?

"12:14:16.314 - FireClient: player argument must be a Player object"

help script:

local tool = script.Parent
local player = game:GetService("Players")
script.Parent.Activated:Connect(function(plr)
	script.Parent.RemoteEvent:FireClient(plr)
end)

local script:

script.Parent.OnClientEvent:Connect(function(plr)
	script.Parent.Parent.Handle.Position = script.Parent.Parent.Part1.Position
	script.Parent.Parent.Part1.Transparency = 1
end)

2 comments

0

in the localscript use localplayer instead of script.parent because when you overuse script.parent you can get confused easily

0

Really, you shouldn't be sending things that the server can do to the client because it is wasting memory and time. You should set the position and transparency, CanCollide, etc. on the Server.

1 answer

You should be changing the part position on the SERVER, not the client. Do this instead:

Local script:

local tool = script.Parent
local player = game:GetService("Players")
script.Parent.Activated:Connect(function()
    script.Parent.RemoteEvent:FireServer()
end)

Server Script:

script.Parent.OnServerEvent:Connect(function(plr)
    plr.Backpack:WaitForChild("Tool").Handle.Position = plr.Backpack:WaitForChild("Tool").Part1.Position
    plr.Backpack:WaitForChild("Tool").Part1.Transparency = 1
end)

--IMPORTANT: Replace tool with the name of the tool

This discussion is preserved as it was. New answers, comments, and votes are closed.