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
01game.Workspace.alarm.Touched:Connect(function(touch)
02     local alarm = false
03     local gui = game.StarterGui.PoliceNoti
04     local alarmevent = game.ReplicatedStorage.AlarmEvent
05    if touch.Parent:FindFirstChild("Humanoid")and game.Workspace.alarmsound.IsPlaying == false then
06        game.Workspace.alarmsound:Play()
07        alarmevent:FireAllClients()
08        gui.Enabled = true
09        alarm = true
10    if alarm == true then
11        wait(16.89)
12        game.Workspace.alarmsound.Volume = 0
13        gui.Enabled = false
14    end
15    end
16end)

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

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

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