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

Tweening issue when player steps on part, why is this?

Here's the script, I'm not sure what exactly is wrong. Thank you in advance if you help :)

local guiname = "MainUI"
local guiname2 = "ShopButtons"

script.Parent.Touched:connect(function(hit)
    if hit == nil then return end
    if hit.Parent == nil then return end

    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player ~= nil then
        if player:FindFirstChild("PlayerGui") then
            if not player.PlayerGui:WaitForChild(guiname) then
                local ui = player.PlayerGui:WaitForChild(guiname).Pets
				local ui2 = player.PlayerGui:WaitForChild(guiname).guiname2
                wait(.1)
				ui.Open.Value = true
				ui2.Open.Value = false
				ui:TweenPosition(UDim2.new(.225,0,.225,0),"In","Bounce",1,true)
				ui2:TweenPosition(UDim2.new(.27,0,-1.1,0),"Out","Bounce",1,true)
            end
        end
    end
end)

I have a GUI that once clicked opens a Pet frame (aka local ui) When I clicked it, it did nothing.

1 answer

You made a mistake at line 11

It should be

if player.PlayerGui:WaitForChild(guiname) then

Instead of

if not player.PlayerGui:WaitForChild(guiname) then

1 comment

0

Thank you for commenting, I am still experiencing issues with this, there are no errors in Server or Client in the developer console

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