Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a key bind for a custom script?

Asked by 4 years ago

I am using a script for a group game, and I was wondering how I add a custom keybind to it. For example, when you press b the script activates.

0
I think you need to learn more. 50michal50 -4 — 4y
0
playlist--> https://www.youtube.com/watch?v=BkYwRdCukZA&list=PLhieaQmOk7nIfMZ1UmvKGPrwuwQVwAvFa it's a good (in my opinion) YouTuber that teaches scripting 50michal50 -4 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You could use remote events.

For example...

Script1, ServerScriptService

game.Players.PlayerAdded:Connect(function()
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
Instance.new("Part", workspace)
    end)
end)

Script2 (local script) , Starterpack

local player = game.Players.LocalPlayer
local REvent = game.ReplicatedStorage.RemoteEvent
local mouse = player:GetMouse()

mouse.KeyDown:connect(function(key)
    if key == "z" then
    REvent:FireServer()
    end
end)
Ad

Answer this question