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

Help With A Sorta VIP Script?

Asked by
Scootakip 299 Moderation Voter
8 years ago

I made a script that teleports you into a certain room, but it was made to only teleport me. However, this script won't work. I made this so far.

function onTouch(part)
    local playyer = part.Parent
    if playyer.Name = ("Player") then
        local torso = part.Parent:FindFirstChild("Torso")
        if torso ~= nil then
            torso.CFrame = CFrame.new(56,26,-94)
        end
    end
end

script.Parent.Touched:connect(onTouch)

It says that it expected a 'then' near the '=' But I have no idea what it means. The script seems fine, I just don't get it.

0
Line 03 needs a double equal sign for equal to. woodengop 1134 — 8y
1
Your problem is at line 3; You need to use '==' to compare a Condition to an Argument, '==' is when your comparing, '=' is when your Setting a Variable to a String, Number, Object, ect. :P TheeDeathCaster 2368 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago
function onTouch(part)
    local playyer = part.Parent
    if playyer.Name == ("Player") then -- When Comparing values, use 2 equal signs, not one.
        local torso = part.Parent:FindFirstChild("Torso")
        if torso ~= nil then
            torso.CFrame = CFrame.new(56,26,-94)
        end
    end
end

script.Parent.Touched:connect(onTouch)


0
Thanks so much! I can't believe I forgot that 0-0 Scootakip 299 — 8y
Ad
Log in to vote
0
Answered by
KoreanBBQ 301 Moderation Voter
8 years ago

Line three, you need two = signs in a comparison.

Answer this question