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

How to make a tool/script admin only(Base on "if username=)?

This is as similar as my last question, but instead of "if username= "script". So i recently i used a script based on "time stopping" from jojo. And i want to make them only me and my friend can use it, but I do not know how to make it so that only i can use it.. https://imgur.com/N7Dqac0

https://imgur.com/NTcdooQ

The ones that are highlighted with yellow are the "Time Stop" script/models i want to restrict them that only i can use it. And of course an answer is always appreciated.

2 answers

✓ Accepted answer

Can you be more specific? You want the tool to be clone only for specific users? if it is then make a script in the serverscriptservice and then put the tool in ReplicatedStorage

local tool = game:GetService("ReplicatedStorage"). -- your item name
local Accessors = {"DONTGIMMEUSELESS", "otherusernameifyouwantot"}

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		for i=1, #Acessors do
			if Player.Name == i[Acessors] then
				local clone = tool:Clone()
				clone.Parent = Player:WaitForChild("Backpack")
				if Character.Humanoid.Health == 0 then -- if you die the tool will clone again
					wait(4.75)
					local clone = tool:Clone()
					clone.Parent = Player:WaitForChild("Backpack")
				end
			end
		end
	end)
end)

I don't know if this is what you want, if it's not then please be more specific. Stay safe.

4 comments

0

To be more specific, i want those that i highlighted in the image link only usable by me.

0

then use this script, but delete the "otherusernameifyouwantot" and delete the comma

0

It doesn't work.. my alt is still able to use the timestop.

0

Nvm, imma make another script.

local whitelist = { -- make a table of your profile IDs
	YourId,
	YourFriendsId
}

Players.PlayerAdded:Connect(function(player) -- detect when a player connected
	local UserId = player.UserId -- get the player's id
	if whitelist[UserId] then -- check if their id is in the whitelist
		--script here
	end
end)

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