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

Is this correct?

I've asked this question twice, I got 2 different answers, Yes and No. Is there something wrong in my script?

permission = {"fahmisack123","A380Guy","ismailtheboss","chrysalisever","backflip123456","HeroFrancis30","HeroicFabian"}

texture = "www.roblox.com/Gem-Tycoon-VIP-Admin-shirt-item?id=129892951"

function checkOkToLetIn(name) 
	for i = 1,#permission do 
		if (string.upper(name) == string.upper(permission[i])) then return true end 
	end 
	return false 
end 

local Door = script.Parent

function onTouched(hit) 
	print("Door Hit") 
	local human = hit.Parent:findFirstChild("Humanoid")
	if (human ~= nil ) then 
		if human.Parent.Torso.roblox.Texture == texture or human.leaderstats.Admins >= 1 then -- I also need help in this line
--CONTENT CENSORED
		elseif (checkOkToLetIn(human.Parent.Name)) then 
--CONTENT CENSORED
			wait(3)
			Door.CanCollide = true 
			Door.Transparency = 0 
		end 
	end 
end 

script.Parent.Touched:connect(onTouched)

EXTRA QUESTION Does Roblox Lua use BIDMAS/BODMAS because then I wouldn't get confused if I calculate 1+1*47+3 which is 51 using BIDMAS/BODMAS

1 comment

0

Changed my answer, pretty sure it'll work.

1 answer

permission = {"fahmisack123","A380Guy","ismailtheboss","chrysalisever","backflip123456","HeroFrancis30","HeroicFabian"}

texture = "www.roblox.com/Gem-Tycoon-VIP-Admin-shirt-item?id=129892951"

function checkOkToLetIn(name) 
    for i = 1,#permission do 
        if (string.upper(name) == string.upper(permission[i])) then return true end 
    end 
    return false 
end 

local Door = script.Parent

function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid")
    if human ~= nil then --Removed Parentheses
        if human.Parent.Torso.roblox.Texture == texture or human.leaderstats.Admins > 1 then -- Changed from >= to >
        elseif checkOkToLetIn(human.Parent.Name) then --Removed Parentheses
			Door.CanCollide = false
        	wait(3)
        	Door.CanCollide = true 
        	Door.Transparency = 0 
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)

6 comments

0

I know. I just forgot to copy that part

0

If you do not give me the whole script (Ctrl + A) I cannot help you, sorry.

0

Bracket's don't make a difference do they? I got the full script for you

0

Yes they do make a difference.

0

In line 18, did I correctly find the leaderstats of a person? Because the output displayed an error (Forgot) and then I did Parent.Parent and the output displayed that leaderstats is not part of Model. What model? and how can I fix this?

0

Also, for line 18, can I do this: if human.Parent.Torso.roblox.Texture == texture or game:GetService("GamePassService"):PlayerHasPass(human, 157283455) then end

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