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

gui script confusing the hell outta me?!

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

✓ Accepted answer

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)

1 comment

0

cheers

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