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

Why is this GUi working in studio, but not in game?

Asked by
Xoqex 75
9 years ago

Alright, so I'm getting into GUi making for my new game. I spent a lot of time getting the effects and everything to work and run smoothly. After using play solo, it was perfect. But I went in game and it doesn't even detect my player clicking the SurfaceGui button. Another weird thing, after using test server in studio, the tab with my character cannot click it, but the other tab that overviews the server can. Pretty weird, right? Anyways, here's the code. (And there are two scripts, but the second is not relevant and doesn't change anything) EDIT: Forgot to mention, I have tried this in both Local and non local scripts. Local scripts didn't even work in play solo, so I turned it back to a regular script.

@TheDeadlyPanther After I added the prints and disabled/reenabled it. I got the following prints: 1,1 5 in that order

EDIT 2: Panther, after noticing you left chat and noticing you didn't get my messages.

right? ROBLOX Xoqex 4 Yes Once clicked, they should all show up So far I clicked play solo, I got 1,1,5 Now I will click and see Everything runs and I get 6 3 4 2 Testing in a server now Alright this is where it gets weird I have output in both server and player tabs of the test server The overview tab has 1,1,5, the player server has nothing. Clicked it in both windows, only the overviewing server tab worked. @TheDeadlyPanther

print("1")
local defaultColor = Color3.new(0, 188, 255)
local poweredDownColor = Color3.new(0,0,0)

local poweredOn = false
local fade = false

local p = script.Parent
print("1")
function chat()
    print("2")
    local word = ("Hello")
    for i=1,string.len(word)do wait(0.1)
    p.Text = string.sub(word,1,i)
    end
end

function fadeout()
    print("3")
    if fade == true then return false end
    fade = true 
    p.TextTransparency = 0
    for i = 0.1,10 do wait(0.1) p.TextTransparency=p.TextTransparency+0.1
    end
    fade = false
end

function fadein()
    print("4")
    if fade == true then return false end
    fade = true 
    p.TextTransparency = 1
    for i = 0.1,10 do wait(0.2) p.TextTransparency=p.TextTransparency-0.1
    end
    fade = false
end


print("5")
script.Parent.MouseButton1Click:connect(function()
    print("6")
script.Parent.Alt.Disabled = true p.TextTransparency = 0 wait(1) fadeout() p.TextColor3 = defaultColor p.Text = ("") fadein() chat()
end)

0
try using WaitForChilds() bubbaman73 143 — 9y
0
I MEAN WAITFORCHILD bubbaman73 143 — 9y
0
What should I be waiting for? LocalPlayer? Xoqex 75 — 9y
0
you need to wait for the GUI bubbaman73 143 — 9y

Answer this question