Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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?

1 comment

0

you can check the player name with an if statement

2 answers

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)

2 comments

0

The script sounds like Vip tools script?

0

Please do not use that script, he just copied a random script, anything may happen.

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.