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

Could someone point me in the right direction on how to find the name of a character?NOT SOLVED..

Hello. This script is for a player only game that is under development. Instead of a password GUI, I want it to just let me and my friend in. Thanks for helping.

Pass= script.Parent.Parent.Parent.Passcode

function Clicked()
	for i=1, 10 do
    wait(0.1)
	script.Parent.ImageTransparency = script.Parent.ImageTransparency +0.1
	end --after this i want this to check if the person who clicked is either the user "123thatalt" or "mendez3581" or "Player1"
	wait(0.3)
	script.Parent.Parent.Visible = false
	for b=1,30 do
	wait(0.001)
	Pass.Position = Pass.Position + UDim2.new(0, 7, 0, 0)
	end
end


script.Parent.MouseButton1Down:connect(Clicked)

2 comments

0

Is this in a LocalScript? What is the parent of script? A TextButton?

0

Parent is a textbutton, yes. And it is in a reg. script.

2 answers

Make this a LocalScript, and try with this code:

Pass= script.Parent.Parent.Parent.Passcode

allowed = {player1 = true, mendez3581 = true, ["123thatalt"] = true}

function Clicked()
    for i=1, 10 do
    wait(0.1)
    script.Parent.ImageTransparency = script.Parent.ImageTransparency +0.1
    end
	if not allowed[Game.Players.LocalPlayer.Name:lower()] then return end --function will exit if not in the 'allowed' dictionary above.
    wait(0.3)
    script.Parent.Parent.Visible = false
    for b=1,30 do
    wait(0.001)
    Pass.Position = Pass.Position + UDim2.new(0, 7, 0, 0)
    end
end


script.Parent.MouseButton1Down:connect(Clicked)

2 comments

0

I tried and the "allowed" script is broken (malformed number) And Im pretty sure that "allowed" is not recognized by LUA.

0

Lua* and look above the function definition. The malformed number is because I forgot to string-ify the username that starts with numbers.

This should be inside Localscript,Starterpack.

Player = game.Players.LocalPlayer

if Player.Name == "YOURNAMEHERE" or "YOURFRIENDSNAMEHERE" then

script:remove()

else

Player:remove()

end

Hope it helped :P

2 comments

0

Didnt work, but thanks for trying :)

0

That if statement always passes: string literalys are truthy, and you didn't do a comparison after the 'or'

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