im just trying to get local inputs to server side using remote events so i can run magic attacks in a server script
The server script keeps erroring and i have little to no coding experience and i need help
any help would be appreciated!
im just trying to get local inputs to server side using remote events so i can run magic attacks in a server script
The server script keeps erroring and i have little to no coding experience and i need help
any help would be appreciated!
You can’t send an input from the player (I think), and if I am right it is because of the context it is in, you are sending a client value to a server. You can always just run the remote event with the code they pressed. So:
game:GetService("ReplicatedStorage").KeyBindEvent:FireServer(input.KeyCode);
And if that doesn’t work just send a string representation:
game:GetService("ReplicatedStorage").KeyBindEvent:FireServer("F");
Client:
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
game:GetService("ReplicatedStorage").KeyBindEvent:FireServer(UIS:GetStringForKeyCode(input.KeyCode))
end)
Server:
game:GetService("ReplicatedStorage").KeyBindEvent.OnServerEvent:Connect(function(player, key)
print(player.Name.." has pressed "..key.." key")
end)
local script showing this error
Sorry, its called GetStringForKeyCode
Edited the script. Im writing this at late night so…
ah alr u have a good night and thanks for the help
To anyone who is for some reason using the keybind space, its " " just a space, not nil or empty, but just a space…