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

Gui doesnt appear before tweening?

Asked by 5 years ago
Edited 5 years ago
game.Workspace.alarm.Touched:Connect(function(touch)
     local alarm = false
     local gui = game.StarterGui.PoliceNoti
     local alarmevent = game.ReplicatedStorage.AlarmEvent
    if touch.Parent:FindFirstChild("Humanoid")and game.Workspace.alarmsound.IsPlaying == false then
        game.Workspace.alarmsound:Play()
        alarmevent:FireAllClients()
        gui.Enabled = true
        alarm = true
    if alarm == true then
        wait(16.89)
        game.Workspace.alarmsound.Volume = 0
        gui.Enabled = false
    end
    end
end)

i also have a 2 second wait built into the local script in the gui which reads as such

local text = script.Parent.TextLabel
local alarmevent = game.ReplicatedStorage.AlarmEvent
alarmevent.OnClientEvent:Connect(function()
    wait(2)
    text.AnchorPoint = Vector2.new(-1, 0)
    text:TweenPosition(UDim2.new(-0,5, 0, 0, 0), nil, nil, 5)
end)

have tried multiple things but it hasnt worked. Everything other than the gui appearing works. No errors in the console nothing, it just refuses to appear

1 answer

Log in to vote
0
Answered by 5 years ago

Okay i see a lot of scripter "Beginners" do this. so you're trying to set gui.Enabled in StarterGui which is NOT what the Player sees on it screen. Basically everything in the Starterguigets copied to the Players Player.PlayerGui But you can't just change it directly from a normal script You have to use a Localscriptbecause a normal one can't change any descants of the PlayerGui but how does a LocalScript know when it has to change it. You have to use RemoteEvents i know you know how to do that

0
That makes alot more sense. I think i just forgot that little tidbit, thanks for the reminder! spot6003 64 — 5y
Ad

Answer this question