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

How to make my script won't work to other players but only a single player can?

Asked by 5 years ago

I use scripts like to blast projectiles out of KeyDown, but when a person got it, i wont recommend that every person can use it?

0
you can check the player name with an if statement SulaymanArafat 230 — 5y

2 answers

Log in to vote
0
Answered by
Delude_d 112
5 years ago
player = {
    "Delude_d"
}

Tool = script.Parent
canUse = Tool:WaitForChild("CanUse")

game.Players.PlayerAdded:Connect(function(p)
    p.CharacterAdded:Connect(function(c)
        for _,v in pairs (player) do
            if p.Name == v then
                ------- Function here
                canUse.Value = true --- this is a variable that can be accessed by any scripts. So, if it's true then it'll let your blast work on only you
            end
        end
    end)
end)

---- Your blast script
Tool = script.Parent
canUse = Tool:WaitForChild("CanUse")

function blast()
    print("blast")
end

Tool.Activated:Connect(function()
    if canUse == true then
    blast()
    end
end)
0
The script sounds like Vip tools script? cherrythetree 130 — 5y
0
Please do not use that script, he just copied a random script, anything may happen. AIphanium 124 — 5y
Ad
Log in to vote
0
Answered by
AIphanium 124
5 years ago
Edited 5 years ago

Your answer is quite easy, if you are trying to create a SHOP or whatever. ALL you have to do is Copying, and Pasting the Tool/Script inside specific player's Backpack!

Hope I Helped!

-- You didn't give me an Example ( Script ) to being with, so... do not expect a script :D.

Note : If what you meant, is making the tool unable to get used for other players if somebody gets the tool?

Then do this! Create a BoolValue inside tool, change it to true, and make the script/function disabled/return if the Value is false, which means you have to do stuff which takes 3 hours, to make it easy.

Just use a BoolValue, change the script so it only works if the BoolValue is true, unless the Value is false, change the BoolValue to false or true after the Tool's Use, that is a very helpful method that i learned during searching in this site, i hope it helps you too!

Answer this question