Its always Precise to use PlayerGui , In your case Just use Script.Parent , StarterGui wont work since its getting the Game’s Gui not the one for the player.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
character:WaitForChild("HumanoidRootPart").Anchored = true
local TweenService = game:GetService("TweenService")
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Camerapart.CFrame
local info = TweenInfo.new(20,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local rotating = true
local MainMenu = script.Parent
local PlayButton = MainMenu.TextButton
local newinfo = TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)
PlayButton.MouseButton1Click:Connect(function()
print("PlayButton Clicked! Now the Tween will play!")
local goal = {};
goal.Position = UDim2.new(-0.2, 0, 0.71, 0)
TweenService:Create(PlayButton,newinfo,goal):Play()
wait(3)
print("Player Spawned!")
character.HumanoidRootPart.Anchored = false
character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
Camera.CameraType = Enum.CameraType.Custom
MainMenu:Destroy()
end)
while rotating do
local cameraTween = TweenService:Create(Camera,info, {CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, 360, 0);})
cameraTween:Play()
local blur = Instance.new("BlurEffect")
blur.Parent = workspace.CurrentCamera
blur.Enabled = true
blur.Size = 10
wait(0.02)
end
Here’s a fixed script of the variables.
PlayerGui is good, but it’s more accessible in my opinion to just go from parent. Since PlayerGui can get confusing easily in some instances.
Ok, problem solved, it was because I didn’t use PlayerGui, I am sorry for wasting time, I’m still new to coding.
PlayerGui and Script.Parent is same for his case here. Im just explaining him how stuffs works .
Do you know how to make it where when you press play, it goes to your character, and your not in the camera anymore?
Just tween the position of the camera to char.Head and then stop the tween so it’s smooth.
Look at my code, I have a while rotating do so if I want the camera to not rotate after the person presses play, would I just set the rotating to false under the while true do?
PlayButton.MouseButton1Click:Connect(function()
print("PlayButton Clicked! Now the Tween will play!")
local goal = {};
goal.Position = UDim2.new(-0.2, 0, 0.71, 0)
TweenService:Create(PlayButton,newinfo,goal):Play()
wait(3)
print("Player Spawned!")
character.HumanoidRootPart.Anchored = false
character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
Camera.CameraType = Enum.CameraType.Custom
MainMenu:Destroy()
end)
while rotating do
local cameraTween = TweenService:Create(Camera,info, {CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, 360, 0);})
cameraTween:Play()
local blur = Instance.new("BlurEffect")
blur.Parent = workspace.CurrentCamera
blur.Enabled = true
blur.Size = 10
wait(0.02)
end
rotating = false
I would assume so, I’ve just started learning about tweening yesterday.
Oh, ok… Thanks for the help! :))