RemoteEvent issues

Most of the time when I try to use remoteEvents, and use a parameter to send a variable over, whatever that variables value was before, on the serverScript it is just the username of whoever triggered the remoteEvent

Example:

LocalScript

script.Parent.MouseButton1Up:Connect(function()
	local uid = script.Parent.Parent.TextBox.Text
	print(uid)
	game.ReplicatedStorage.RemoteEvent:FireServer(uid)
end)

ServerScript

local dummy = workspace.R6
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(uid)
	print(uid)

local newHumanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(uid)

	dummy.Humanoid:ApplyDescription(newHumanoidDescription)
	end)

From the print statement in the local script, it prints the uid, but on the serverscript, it prints my username

The reason for this is probably because .OnServerEvents first argument is a player, try this:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(Player, uid)

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