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

Hello, I need to know if this script would work correctly?

Before you say "Test it!" or something, I can't because I am on a laptop that does not support ROBLOX Studio.

local Player = game.Players.LocalPlayer
local FadeFrame = Player.PlayerGui.TeleportGui.FadeFrame
local Button = script.Parent

--[Gui visible
Teleport to SpawnTeleportPart
Gui Invisible]--

function onClick()
wait(0.5)
FadeFrame.Visible = true
wait(1)
Player.Character.Torso.CFrame = game.Workspace.ImportantItems.SpawnTeleportPart.CFrame
wait(1)
FadeFrame.Visible = false
end
Button.MouseButton1Click:connect(onClick)

1 answer

✓ Accepted answer

Yes, that would work but this is a revised and upgraded version I cooked up for you.

Button.MouseButton1Down:connect(function()
	wait(0.5)
	FadeFrame.BackgroundTransparency = 1
	FadeFrame.Visible = true
	for i = 1,10 do
		FadeFrame.BackgroundTransparency = FadeFrame.BackgroundTransparency - 0.1
		wait()
	end
	Player.Character.Torso.CFrame = game.Workspace.ImportantItems.SpawnTeleportPart.CFrame
	wait()
	for i = 1,10 do
		FadeFrame.BackgroundTransparency = FadeFrame.BackgroundTransparency + 0.1
		wait()
	end
	FadeFrame.Visible = false
end)

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