To make it better, you could make it so that the players wouldn’t be able to move and they spawn somewhere like a spawn box and they spawn on a part somewhere on the baseplate
-- Let's Define a Few Important Variables first!
local button = script.Parent -- We define our button, which is a child to this script.
local description = button:WaitForChild("Description") -- Get's the description thats inside the button.
local tweenService = game:GetService("TweenService") -- This allows us to do smooth animations!
local tweenInfo = TweenInfo.new(0.35, Enum.EasingStyle.Quad) -- This is the info for our tweens. The first Int is the duration of time (in seconds) it takes to finish a tween and the second Value is the EasingStyle. You can play around with both and see if you find something you like!
-- Now Let's program the button!
button.MouseEnter:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button. Let's make some nice animations.
tweenService:Create(description, tweenInfo, {TextTransparency = 0}):Play() -- Makes the description text visible.
button:TweenSize(UDim2.new(0.209, 0, 0.057, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it bigger
end)
button.MouseLeave:Connect(function() -- The code inside this function occurs whenever the players mouse is over the button, but then leaves.
tweenService:Create(description, tweenInfo, {TextTransparency = 1}):Play() -- Makes the description text invisible.
button:TweenSize(UDim2.new(0.202, 0, 0.051, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.1, true) -- tweens the size of the button and makes it the base size of what it was
end)
button.MouseButton1Click:Connect(function() -- The code inside this function occurs whenever the player clicks the button.
local clickSFX = script.Parent.Parent.Click
-- clickSFX:Play() -- OPTIONAL, UNCOMMENT IF YOU WANT A SOUND TO PLAY WHEN THE PLAYER CLICKS THE BUTTON.
local CurrentCamera = workspace.CurrentCamera
workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character
CurrentCamera.CameraType = Enum.CameraType.Custom
end)