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

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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)
Ad

Answer this question