Humanoid not accessable on server

  1. What do you want to achieve?

I want to make players have a speed boost.

  1. What is the issue?

I don’t understand why I can’t change the humanoid walkspeed of a player on the server.

Functions.Receive.OnServerInvoke = function(player,level,index,humanoid)
	receiveModule.new(player,level,index):Init()
	humanoid.WalkSpeed = level:GetAttribute("Speed")
	return "Change"
end

I’m trying to change the player’s walkspeed on the server here.

itemBuy.MouseButton1Up:Connect(function()
	--What happens if you press it when it says equip
	if itemBuy.Text == "Equip" then
		local findLevel = buyModule.new(shopIndex,Levels,rootPart):Init()
		local invoke = Functions.Receive:InvokeServer(findLevel,shopIndex,humanoid)
		if invoke == "Change" then
			itemBuy.Text = "Unequip"
		end

With some code cut out, you can see im firing this event under conditions and when a button is clicked.

  1. What solutions have you tried so far?

You can see I used the humanoid as a parameter when I previously used “player.Character.Humanoid”. I also asked the AI assistant and it said something along the lines of humanoids cannot be accessed from the game world if they are in module scripts. So I moved it to the inside of the remote event.

1 Like

Is there an error logged to the console?

Nothing on the output. Thirty cars

I suggest adding a print, such as:

print(humanoid:GetFullName())

To trace back the instance. Check what the print says if attempted.

I fixed this issue, another piece of code was interjecting.

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