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

Can you help me with using spaces in scripts?

Asked by 10 years ago

I am making a (non-gamepass) VIP door that relies on looking at your shirt's graphic. I followed a WikiHow script for making this possible. I put two stars beside the area that I need help with. My Current script is:

print ("VIP T-Shirt Door Script Loaded")
-- list of account names allowed to go through the door.
permission = { "YourNameHere" } -- This is how many people can still get through, so you don't have to change shirts. You can also have another friend here.
-- Texture of the VIP shirt.
texture = "http://www.roblox.com/asset/?id=153038831" -- Go to the wiki below this script to find out how to change the shirt. And paste the link in between the "" marks.
function checkOkToLetIn(name)
for i = 1,#permission do
-- convert strings to all upper case, otherwise we will let in
-- "Username" but not "username" or "uSERNAME"
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.**ShirtGraphic**.Graphic == texture then --the shirt
Door.Transparency = 0.7
Door.CanCollide = false
wait(4) -- this is how long the door is open
Door.CanCollide = true
Door.Transparency = 0
-- a human has touched this door!
print("Human touched door")
-- test the human's name against the permission list
elseif (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.7
Door.CanCollide = false
wait(4) -- this is how long the door is open
Door.CanCollide = true
Door.Transparency = 0
else human.Health = 0 -- delete this line of you want a non-killing VIP door
end
end
end
script.Parent.Touched:connect(onTouched)

In the starred area, I need a space in between there so that my world looks in the right place for the graphic of the person's t-shirt who touches the wall. Can you either find a way to add a space? Or I would also be happy to get a script that renames every "Shirt Graphic" to "ShirtGraphic".

2 answers

Log in to vote
2
Answered by
Bebee2 195
10 years ago

A neat thing in Lua is that you can index objects like this:

if human.Parent['Shirt Graphic'].Graphic == texture then
0
Thanks a lot! I rally needed this to make a VIP door of my own. HECKFURNIOUS 85 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

You can use Parent["Shirt Graphic"].Graphic Note: I did not put a space after "Parent"

Answer this question