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

whats wrong with my script?

i have tried using a script that closes the script but makes you teleport to the place

function onClicked()
	script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-1052, 752, 701.4) 
end
script.Parent.MouseButton1Down:connect(onClicked)
local Frame = script.Parent.Parent 
function onClick() 
Frame.Visible = false 
end 

script.Parent.MouseButton1Click:connect(onClick) '

didnt work...

2 comments

0

Use the code block formatting next time.

0

i dont know how to code block

1 answer

✓ Accepted answer

I'm assuming this is a ScreenGui? If so you could use LocalPlayer and it would be a lot easier.

script.Parent.MouseButton1Down:connect(function()
	local plr = game.Players.LocalPlayer
	local frame = script.Parent.Parent
	plr.Character:MoveTo(Vector3.new(-1052, 752, 701.4)
	frame.Visible = false
end

Comment if it didn't work.

4 comments

0

where do i put it?

0

Inside the TextButton.

0

diddnt work

0

Did you get any errors in the output?

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