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

My Remote Event Fire Script isn't working, help?

So I have a script that fires a client event, a sell event, but it seems to not work.

script.Parent.Touched:connect(function(part)
local player = game.Players:GetPlayerFromCharacter(part.Parent)
workspace.Events.SandSell:FireClient(player)
end)

Also the formatting is correct in the script itself, just got transferred weirdly. The output is: 17:07:21.572 - FireClient: player argument must be a Player object

1 answer

✓ Accepted answer
local RemoteEvent = workspace.Events.SandSell

local function Touched (Part)
	local Player = game.Players:GetPlayerFromCharacter(Part.Parent)
	if Player then
		RemoteEvent:FireClient(Player)
	end
end

script.Parent.Touched:Connect(Touched)

You have to make sure that the object that touches the part is a character.

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