I have a gui, in this gui you can choose your difficulty level, when you press normal easy or hard, start button show up the issue is i have a reset button this button will be resetting localplayer game. So when reset button pressed the starter gui will be showed up, it shows up but start button doesnt come up. Here is a little clip what i mean
local button = script.Parent.TextButton
local Remote = game.ReplicatedStorage.CheckPoint
local NPC = game.Workspace:WaitForChild("CellatBaba")
local player = game:GetService("Players").LocalPlayer
local speed = player.PlayerGui:WaitForChild("Speed"):WaitForChild("Frame")
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")
button.MouseButton1Up:Connect(function()
speed:TweenPosition(
UDim2.new(0, 0,-0.068, 0),
"Out",
"Quad",
1
)
game.Players.LocalPlayer.Character.Humanoid.Health = 0
Remote:FireServer()
NPC:SetPrimaryPartCFrame(CFrame.new(game.Workspace.Teleport.Position))
end)
This is difficulty script (3 of them are same)
local Frame = script.Parent.Parent
local Button = script.Parent
local start = game.StarterGui.Start.Start
local player = game:GetService("Players").LocalPlayer
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")
function Start()
start:TweenPosition(
UDim2.new(0.5, 0,0.88, 0),
"Out",
"Quad",
0.7,2
)
end
function Speed()
Frame:TweenPosition(
UDim2.new(0, 0,-2, 0),
"Out",
"Quad",
2
)
end
Button.MouseButton1Up:Connect(function()
Speed()
Start()
end)
local Frame = script.Parent.Parent
local Button = script.Parent
local player = game:GetService("Players").LocalPlayer
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")
function Start()
start:TweenPosition(
UDim2.new(0.5, 0,0.88, 0),
"Out",
"Quad",
0.7
)
end
function Speed()
Frame:TweenPosition(
UDim2.new(0, 0,-2, 0),
"Out",
"Quad",
2
)
end
Button.MouseButton1Up:Connect(function()
Speed()
Start()
end)
I think it was treating it as if you were tweening something from StarterGui cause of that first line you had
Whatever you’re tweening is causing the error, it either does not exist at the time or is re-parented.
That error only occurs when the parent of the tween object is set to nil, or another area out of the UI that is considered “out the workspace” (with the workspace being the UI itself). There is no other possible way to recreate the error.
This can happen by either changing the parent or destroying the tweened instance.