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

gui script confusing the hell outta me?!

Asked by
KenzaXI 166
8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

hi i made this script, it's inside a textbox from a screengui :

local i = script.Parent
local map = game.Workspace.Map1.sa
function onButtonClicked()
        local plr = game.Players.LocalPlayer
        plr.Position = map.Position
end
i.MouseButton1Down:connect(onButtonClicked)

idk is wrong with it :/ Please help, any help at all will be greatly appreciated

1 answer

Log in to vote
1
Answered by
rexbit 707 Moderation Voter
8 years ago

1st Problem is that you placed the code in a script, should be a LocalScript.

2nd Problem is line 05 you are positioning a Player, You should access the Player's Character, then Position it by it's Torso or Position the Model itself by using the MoveTo Method.


local i=script.Parent
local map=workspace.Map1.sa

function onButtonClicked()
    local plr=game.Players.LocalPlayer
    local character=plr.Character

    character:MoveTo(map.Position)
end

i.MouseButton1Down:connect(onButtonClicked)

0
cheers KenzaXI 166 — 8y
Ad

Answer this question