TweenService: Can only tween objects in the workspace

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    a: I need to fix an issue

  2. What is the issue? Include screenshots / videos if possible!
    a: the issue is that everytime that a character resets or dies the TweenService doesnt work and just gives me the error message: Can only tween objects in the workspace

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    a: I tried looking for answers on the Devforum and found no solution that worked for my problem

I have this script where everytime a player gets more points a text pops up where it says how much points it got but everytime that the player dies it stops working and the error message just says “Can only tween objects in the workspace”. I hope someone can help me with this, I put the script down below

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local clicks = leaderstats:WaitForChild("points")

local playerGui = player:WaitForChild("PlayerGui")
local screengui = playerGui:WaitForChild("ScreenGui")

local replicatedStorage = game:GetService("ReplicatedStorage")
local clicksPopUpTemplate = replicatedStorage:WaitForChild("clicksPopUp")

local oldClicksValue = clicks.Value

local rebirths = leaderstats:WaitForChild("rebirths")



rebirths.Changed:Connect(function()
	oldClicksValue = 0
end)



clicks.Changed:Connect(function()
	local clicksPopUp = clicksPopUpTemplate:Clone()
	clicksPopUp.Parent = screengui
	
	local randomNum1 = math.random(3,8)/10
	local randomNum2 = math.random(2,7)/10
	
	local newClicksValue = clicks.Value
	local value = newClicksValue - oldClicksValue
	if value > 0 then
		clicksPopUp.amount.Text = "+"..value
		oldClicksValue = clicks.Value
		clicksPopUp.Visible = true
		clicksPopUp.Position = UDim2.new(randomNum1,0,randomNum2,0)
		
		
		clicksPopUp:TweenSize(
			UDim2.new(0.237,0,0.102,0),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Back,
			0.5,
			false,
			nil
		)
		wait(0.5)
		clicksPopUp:TweenSize(
			UDim2.new(0,0,0,0),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Sine,
			0.5,
			false,
			nil
		)
		wait(0.5)
		clicksPopUp:Destroy()
	end
end)
2 Likes

Try turning off ResetOnSpawn in the ScreenGui object if it isn’t already.

2 Likes

This fixed it, thanks!

30 letterrsssss

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.