Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this not work?

 local cd = script.Parent

function onclick(Player)
print("PassedTheFunction")
if Player.PlayerGui:FindFirstChild("BoomGui") == nil and game.Workspace:FindFirstChild("LocalSoundForBoomBox") == nil then
	print("les get it started in ere")
	game.ReplicatedStorage.BoomGUI:Clone().Parent = Player.PlayerGui
    print("It should give it to us!")
end
end

cd.MouseClick:connect(onclick)

The script runs, I see all of the prints in the output, no errors in the output, doesn't give the the "BoomGUI". Please help.

4 answers

Make local cd = script.Parent to cd = script.Parent

1 comment

0

Nope, I actually solved the problem, the gui was invisible! Sorry, guys.

make it a local function

 local cd = script.Parent

local function onclick(Player)
print("PassedTheFunction")
if Player.PlayerGui:FindFirstChild("BoomGui") == nil and game.Workspace:FindFirstChild("LocalSoundForBoomBox") == nil then
    print("les get it started in ere")
    game.ReplicatedStorage.BoomGUI:Clone().Parent = Player.PlayerGui
    print("It should give it to us!")
end
end

cd.MouseClick:connect(onclick)

1 comment

0

Still doesn't work, even with a local function.

 local cd = script.Parent

function onclick(Player)
print("PassedTheFunction")
if Player.PlayerGui:FindFirstChild("BoomGui") == nil and game.Workspace:FindFirstChild("LocalSoundForBoomBox") == nil then
    print("les get it started in ere")
    game.ReplicatedStorage.BoomGUI:clone().Parent = Player.PlayerGui --clone() not Clone()
    print("It should give it to us!")
end
end

cd.MouseClick:connect(onclick)

This discussion is preserved as it was. New answers, comments, and votes are closed.