Sending multiple variables through remote event getting messed up

For some reason the “OtherHum” is my players name when sent through the server and “Custombox” is humanoid when also sent through server.

I have no idea why its doing it

ALSO this script is about an admin panel
(the script is very long so I’m just showing what I think is causing it)

local script (before the info is sent to the server)

ExecutionButton.Activated:Connect(function()
	if walkspeedOn == true then
		Errorlabel.Text = "Error checker:"
		local Findplayer = game.Players:FindFirstChild(Targetbox.Text)
		if Findplayer then
			local OtherChar = workspace:FindFirstChild(Findplayer.Name)
			local OtherHum = OtherChar:FindFirstChild("Humanoid")
			if Custombox == nil then
				Errorlabel.Text = "Error checker: Custom input empty"
			else
				RS.Commandremotes.WalkspeedRemote:FireServer(OtherHum, Custombox)
			end
		else
			Errorlabel.Text = "Error checker: Player not found"
		end
	elseif jumppowerOn == true then
		Errorlabel.Text = "Error checker:"
		local Findplayer = game.Players:FindFirstChild(Targetbox.Text)
		if Findplayer then
			local OtherChar = workspace:FindFirstChild(Findplayer.Name)
			local OtherHum = OtherChar:FindFirstChild("Humanoid")
			if Custombox == nil then
				Errorlabel.Text = "Error checker: Custom input empty"
			else
				RS.Commandremotes.JumppowerRemote:FireServer(OtherHum, Custombox)
			end
		else
			Errorlabel.Text = "Error checker: Player not found"
		end
	else
		Errorlabel.Text = "Error checker: Command not selected"
	end
end)

the server script

local RS = game:GetService("ReplicatedStorage")
local Walkspeedremote = RS.Commandremotes.WalkspeedRemote
local Jumppowerremote = RS.Commandremotes.JumppowerRemote

Walkspeedremote.OnServerEvent:Connect(function(OtherHum, Custombox)
	OtherHum.WalkSpeed = Custombox.Text
end)

Jumppowerremote.OnServerEvent:Connect(function(OtherHum, Custombox)
	OtherHum.JumpPower = Custombox.Text
end)

That’s because the first parameter to any OnServerEvent callback will always be the client that fired the event.

2 Likes

I think you have to fire events to the specific player if your not using fireallclients.

this worked i had to do other stuff to fix it more but this was the main issue

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.