- What do you want to achieve?
I want to make players have a speed boost.
- 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.
- 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.