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

How would I make this accessible to only one specific user?

Asked by
neoG457 315 Moderation Voter
9 years ago
local player = game.Players.LocalPlayer

local mouse = player:GetMouse()
    mouse.KeyDown:connect(debounce(function(key)

    if key == "r" then

I want this to only be available to a user I choose.

Can anybody help me?

Its in a local script btw

1 answer

Log in to vote
1
Answered by 9 years ago

Well one way is you could have a server script in Workspace with the local script disabled inside and do

local ls = script.LocalScript

game.Players.PlayerAdded:connect(function(plr)
    if plr.Name == "GuyWhoIWant" then
        local give = function()
            local cls = ls:Clone()
            cls.Parent = plr.PlayerGui --Or wherever you want it
            cls.Disabled = false
        end
        give()

        plr.CharacterAdded:connect(function()
            give()
        end)
    end
end)
0
It works, thanks a bunch. neoG457 315 — 9y
Ad

Answer this question