FireClient: Player argument must be a player object?

Hi devs, My script is not working for seemingly no reason

for context: I have 2 scripts 1 server and 1 client

I’m trying to make a tween play on the client side when you touch a part on the server side but keep getting this error

FireClient: player argument must be a player object
on line 9

heres my server script

local hitbox = script.Parent.Hitbox
local trap = script.Parent.Trap

local ps = game:GetService("Players")

hitbox.Touched:Connect(function(hit)
	local char = hit.Parent
	local plr = ps:GetPlayerFromCharacter(char)
	trap:FireClient(plr)
end)

heres my client side

local hitbox = script.Parent.Hitbox
local platform = script.Parent

local ts = game:GetService("TweenService")
local tinfo = TweenInfo.new(.5)
local tween = ts:Create(platform,tinfo,{Position=Vector3.new(15, -1, 30.1)})

local trapevent = script.Parent.Trap

trapevent.OnClientEvent:Connect(function()
	tween:Play()
end)

fixed the problem with this code on server side

local hitbox = script.Parent.Hitbox
local trap = script.Parent.Trap

local ps = game:GetService("Players")

hitbox.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		trap:FireClient(plr)
	end
end)

Now the tween isnt playing??

1 Like

got it working!!!

I just needed to move the remote event into replicated storage and move the client script to starterplayerscripts