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

How do i fix it? Problem with .Touched and with RemoteEvent

Basically im trying to make "Touch part to fire remote", when player touched it, player will be transformed, but when player touches it, instead of transforming player, all players are transforming (Sorry for bad english) here is script (Local Script)

oil.Touched:Connect(function(touched)
	if active then return end
	if not active then
		local hum = touched.Parent:FindFirstChild("Humanoid")
		if hum then
			active = true
			local char = hum.Parent
			local plr = players:GetPlayerFromCharacter(char)
			oiled:FireServer(plr, "OilInfect")
		end
	end
end)

1 answer

First of all, we can't really help you with your script without the rest of it. Where is the code that listens for the remote to be fired?

-- Also
oiled:FireServer(plr, "OilInfect")
--When you do remote:FireServer, the player is automatically passed over to the function that listens for it
-- So if you type Remote:FireServer() your scripts function will look like function RemoteFired(player)
-- So in your case
-- oiled:FireServer(plr, "OilInfect") should just be
-- oiled:FireServer("OilInfect")
-- and on your server script it should listen for it like
local function Oiled(player,Value)

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