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

why is this gui not popping up upon event?

Asked by 5 years ago

Hello, I was wondering if you guys could help me with something, im trying to make a gui that pops up when you join but it doesn't work

local frame = script.Parent
local Players = game:GetService("Players")
Players.PlayerAdded:connect(function()
    frame:TweenPosition(UDim2.new(0, 10, 0, 10))
    end)

1 answer

Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago
Edited 5 years ago

For first, PlayerAdded not work in LocalScript. you need to use CharacterAdded.

Remember. :connect is deprecated use :Connect

Wiki pages:

Player Added

Character Added

You can try this:

-- LOCAL SCRIPT --
local frame = script.Parent
local Player = game:GetService("Players").LocalPlayer

Player.CharacterAdded:Connect(function()
    if frame.Position ~= UDim2.new(0, 10, 0, 10) then
            frame:TweenPosition(UDim2.new(0, 10, 0, 10))
    end
end)

Hope it helped! :)

0
Thx! :D Carvizal 25 — 5y
Ad

Answer this question