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

Level teleport button?

Asked by
nicros 165
9 years ago

So i know very little about lua ive basically been taking free scripts and modifying/combining them to do what i need.

so, what i need today is i have this teleport button script

torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso 

function onClicked(GUI)
        torso.CFrame = CFrame.new(Vector3.new(-432, 2.2, 64)) --Put the position of the part here
end 

script.Parent.MouseButton1Click:connect(onClicked) 

this is for an RPG so i have levels....and i want to make this work but only if you are level for example 5

i thought i could copy this line into it and have it work but i guess not

    player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player.leaderstats.Lvl.Value >= 1 then

so what i would have after this was

torso = script.Parent.Parent.Parent.Parent.Parent.Character.Torso 

function onClicked(GUI)

    player = game.Players:GetPlayerFromCharacter(hit.Parent)

        if player.leaderstats.Lvl.Value >= 1 then
            torso.CFrame = CFrame.new(Vector3.new(228.6, 393.05, 117)) --Put the position of the part here
end 

any help on walking me through this would be appreciated :)

Answer this question