So I'm passing arguments through RemoteEvents
and what seems to be happening is I would pass a key string from the client and on the server, it would print the local script's parent's name.
--Local Script (the parent is a tool named LBABall in Workspace) function onKeyPress1(inputObject, gameProcessedEvent) local key = inputObject.keyCode if key then if (key == Enum.KeyCode.E) then ToolKeyDownEvent:FireServer(script.Parent, "E", keys) end if (key==Enum.KeyCode.Q) then ToolKeyDownEvent:FireServer(script.Parent, "Q", keys) end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress1) -- Server Script (the parent is ServerScriptService) ToolKeyDownEvent.OnServerEvent:connect(function(parent, key, keys) print(key) -- This prints "LBABall" if key == "E" then print("E is running") keys[1]=true repeat if parent.Character.LBABall.PowerValue.Value <= 90 then parent.Character.LBABall.PowerValue.Value=parent.Character.LBABall.PowerValue.Value+5 else parent.Character.LBABall.PowerValue.Value=100 end wait(0.5) until keys[1]==false elseif key == "Q" then print("Q is running") keys[2]=true repeat if parent.Character.LBABall.PowerValue.Value >= 10 then parent.Character.LBABall.PowerValue.Value=parent.Character.LBABall.PowerValue.Value-5 else parent.Character.LBABall.PowerValue.Value=0 end wait(.5) until keys[2]==false end end)
This is because automatically, the first argument of OnServerEvent is the player who fired the remote. So, you just need to put the place where it sends the player who fired the remote to a different variable. For example, you could do
ToolKeyDownEvent.OnServerEvent:connect(function(_, parent, key, keys) print(key) if key == "E" then print("E is running") keys[1]=true repeat if parent.Character.LBABall.PowerValue.Value <= 90 then parent.Character.LBABall.PowerValue.Value=parent.Character.LBABall.PowerValue.Value+5 else parent.Character.LBABall.PowerValue.Value=100 end wait(0.5) until keys[1]==false elseif key == "Q" then print("Q is running") keys[2]=true repeat if parent.Character.LBABall.PowerValue.Value >= 10 then parent.Character.LBABall.PowerValue.Value=parent.Character.LBABall.PowerValue.Value-5 else parent.Character.LBABall.PowerValue.Value=0 end wait(.5) until keys[2]==false end end)
Hope this helps!