TweenSize() doesn't work

  1. What do you want to achieve?
    Make so when the player touches a part he gets sick

  2. What is the issue?
    GUI doesn’t tween, but it plays the sound and prints.

  3. What solutions have you tried so far?
    I tried everything even changing to a server sided script.

local gui = game.StarterGui:WaitForChild("A")
local frame = gui:WaitForChild("anxiety")
script.Parent.Touched:Connect(function(addAnxiety)
	print('nothing')
	frame:TweenSize(UDim2.new(0, 448,0, 56),Enum.EasingDirection.In,Enum.EasingStyle.Back,2)
	workspace.cough:Play()
	workspace.cough.Looped = true
end)
1 Like
  1. Assuming you’re doing this on the client, local scripts don’t work in the workspace.
  2. Use PlayerGui instead of StarterGui.
2 Likes
  1. Yep I am using server script now.
  2. I already tried and nothing

Is there any way to fix this?

Can I see the script that used PlayerGui?

local player = game:GetService("Players").LocalPlayer
local gui = script:WaitForChild("A"):Clone()
local frame = gui:WaitForChild("anxiety")
script.Parent.Touched:Connect(function(addAnxiety)
	gui.Parent = player.PlayerGui
	print('nothing')
	frame:TweenSize(UDim2.new(0, 448,0, 56),Enum.EasingDirection.In,Enum.EasingStyle.Back,2)
	wait(2)
	workspace.cough:Play()
	workspace.cough.Looped = true
end)

maybe it’s wrong, im starting to script

Local scripts don’t work in the workspace.

79a24f99d6afba6ba39c0b565c2b051f

You can’t use LocalPlayer in a server script.

1 Like

Then how I would put it on PlayerGui?

You cannot use Players | Roblox Creator Documentation in a server script. But you can use Players | Roblox Creator Documentation

local gui = script:WaitForChild("A"):Clone()
local frame = gui:WaitForChild("anxiety")
script.Parent.Touched:Connect(function(addAnxiety)
	if addAnxiety.Parent:FindFirstChild("Humanoid") then
	local player = game:GetService("Players"):GetPlayerFromCharacter(addAnxiety.Parent)
	gui.Parent = player.PlayerGui
	print('nothing')
	frame:TweenSize(UDim2.new(0, 448,0, 56),Enum.EasingDirection.In,Enum.EasingStyle.Back,2)
	wait(2)
	workspace.cough:Play()
		workspace.cough.Looped = true
	end
end)
2 Likes

Is there a way to I make the gui always appears?

Hello, what do you mean by that?

I want it to when you spawn on the game you have this GUI here
70f5ea122d0a0d9b2354bcfbe51dee5b
but instead it just appears when i touch the part.

Then you can put it in StarterGui and when the player joins the game, it will be copied to the player’s PlayerGui.

2 Likes