Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Vxpper 101
4 years ago

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

Log in to vote
0
Answered by
SCP774 191
4 years ago

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
0
Thank you for commenting, I am still experiencing issues with this, there are no errors in Server or Client in the developer console Vxpper 101 — 4y
Ad

Answer this question