Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GUI tweening not playing when touched?

I Wrote down the script for this, this is the script:

local gui = game.ReplicatedStorage.EasyGUI
local frame = gui.Frame
	 
	local function onTouched(hit)
	    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	 
	    if player then
	        local clone = gui:Clone()
	        clone.Parent = player.PlayerGui
	
	        local tweenService = game:GetService("TweenService")
	        local tweenInfo = TweenInfo.new(
	2, -- Length
Enum.EasingStyle.Linear, -- Easing style of the TweenInfo
Enum.EasingDirection.In, -- Easing direction of the TweenInfo
0, -- Number of times the tween will repeat   
false, -- Should the tween repeat?
2 -- Delay between each tween  
)

local frameProperties = {
    Size = Vector3.new{0, 210},{0, 210};
    BackgroundColor3 = Color3.new(255, 255, 255);
    BackgroundTransparency = 1
}

local Tween = tweenService:Create(frame,tweenInfo,frameProperties)
Tween:Play()

	wait(3)
	
	local tweenService = game:GetService("TweenService")
	        local tweenInfo = TweenInfo.new(
	2, -- Length
Enum.EasingStyle.Linear, -- Easing style of the TweenInfo
Enum.EasingDirection.Out, -- Easing direction of the TweenInfo
0, -- Number of times the tween will repeat   
false, -- Should the tween repeat?
2 -- Delay between each tween  
)

local frameProperties = {
    Size = Vector3.new{0, 210},{0, 210};
    BackgroundColor3 = Color3.new(255, 255, 255);
    BackgroundTransparency = 1
}

local Tween = tweenService:Create(frame,tweenInfo,frameProperties)
Tween:Play()		
	
	end
	end
	 
	script.Parent.Touched:Connect(onTouched)

what i am trying to accomplish here is making the gui slide into the screen and sliding out.

i really need help with this, i cant seem to get it. if you are in need of more info, Please let me know!

5 comments

0

how come ur question did not get taken down my moderators?

0

by*

1

He has a problem, has visible code that shows the action of which he's trying to achieve, and explains the issue.

1

https://scriptinghelpers.org/help/community-guidelines. Under Website Guidelines, Bullet 2, first point.

0

Jeez! How do iVmk3 get so low of a reputation?

1 answer

Hello.


Problems:

  • A gui's size uses UDim2, not Vector2.

  • You used Color3.new() instead of Color3.fromRGB().


Solutions:


Fixed Script:

local gui = game.ReplicatedStorage.EasyGUI
local frame = gui.Frame

    local function onTouched(hit)
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)

        if player then
            local clone = gui:Clone()
            clone.Parent = player.PlayerGui

            local tweenService = game:GetService("TweenService")
            local tweenInfo = TweenInfo.new(
    2, -- Length
Enum.EasingStyle.Linear, -- Easing style of the TweenInfo
Enum.EasingDirection.In, -- Easing direction of the TweenInfo
0, -- Number of times the tween will repeat   
false, -- Should the tween repeat?
2 -- Delay between each tween  
)

local frameProperties = {
    Size = UDim2.new(0, 210, 0, 210);
    BackgroundColor3 = Color3.fromRGB(255, 255, 255);
    BackgroundTransparency = 1
}

local Tween = tweenService:Create(frame,tweenInfo,frameProperties)
Tween:Play()

    wait(3)

    local tweenService = game:GetService("TweenService")
            local tweenInfo = TweenInfo.new(
    2, -- Length
Enum.EasingStyle.Linear, -- Easing style of the TweenInfo
Enum.EasingDirection.Out, -- Easing direction of the TweenInfo
0, -- Number of times the tween will repeat   
false, -- Should the tween repeat?
2 -- Delay between each tween  
)

local frameProperties = {
    Size = UDim2.new(0, 210, 0, 210);
    BackgroundColor3 = Color3.fromRGB(255, 255, 255);
    BackgroundTransparency = 1
}

local Tween = tweenService:Create(frame,tweenInfo,frameProperties)
Tween:Play()        

    end
    end

    script.Parent.Touched:Connect(onTouched)

2 comments

0

i tried this out in a server script, i didnt get any errors but neither did it work. Did i have to use a local script?

0

YES YOU DO WITH A GUI

This discussion is preserved as it was. New answers, comments, and votes are closed.