So I recently put in a simple script where a clickdetector makes a GUI visible. But it does not work in game/online. this is the script: the script is inside the GUI, its a localscript not a server one
plr = game.Players.LocalPlayer text = plr.PlayerGui.quirklabel.TextLabel click = game.Workspace.Doctor.Head.ClickDetector click.MouseClick:connect(function() if plr.check.Value == 1 then plr.check.Value = plr.check.Value -1 text.Visible = true wait(2) text.Text = "Im here to show you your quirk results!" wait(2) text.Text = "And your quirk is..." wait(2) local quirk = math.random(1,20) if quirk == 1 then plr.Quirk.Value = "Super Regeneration" text.Text = "Super Regeneration!" end if quirk == 2 then plr.Quirk.Value = "Super Regeneration" text.Text = "Super Regeneration!" end if quirk == 3 then plr.Quirk.Value = "Super Regeneration" text.Text = "Super Regeneration!" end if quirk == 4 then plr.Quirk.Value = "Super Regeneration" text.Text = "Super Regeneration!" end if quirk == 5 then plr.Quirk.Value = "Super Regeneration" text.Text = "Super Regeneration!" end if quirk == 6 then plr.Quirk.Value = "Transparency" text.Text = "Transparency!" end if quirk == 7 then plr.Quirk.Value = "Transparency" text.Text = "Transparency!" end if quirk == 8 then plr.Quirk.Value = "Transparency" text.Text = "Transparency!" end if quirk == 9 then plr.Quirk.Value = "Transparency" text.Text = "Transparency!" end if quirk == 10 then plr.Quirk.Value = "Transparency" text.Text = "Transparency!" end if quirk == 11 then plr.Quirk.Value = "Half Hot Half Cold" text.Text = "Half Hot Half Cold!" end if quirk == 12 then plr.Quirk.Value = "Half Hot Half Cold" text.Text = "Half Hot Half Cold!" end if quirk == 13 then plr.Quirk.Value = "Half Hot Half Cold" text.Text = "Half Hot Half Cold!" end if quirk == 14 then plr.Quirk.Value = "Explosion" text.Text = "Explosion!" end if quirk == 15 then plr.Quirk.Value = "Explosion" text.Text = "Explosion!" end if quirk == 16 then plr.Quirk.Value = "Explosion" text.Text = "Explosion!" end if quirk == 17 then plr.Quirk.Value = "Electrification" text.Text = "Electrification!" end if quirk == 18 then plr.Quirk.Value = "Electrification" text.Text = "Electrification!" end if quirk == 19 then plr.Quirk.Value = "Electrification" text.Text = "Electrification!" end if quirk == 20 then plr.Quirk.Value = "One For All" text.Text = "One For All!" end wait(0.8) plr.Character.Humanoid.Health = 0 text.Visible = false end end)
Try making all ":connect" into ":Connect"
code should be in a server script in the head of the doctor with the click detector like this . Code:
local click = script.Parent:WaitForChild("ClickDetector") click.MouseClick:Connect(function(plr) --plr is the player who clicked, its the only way to do it in server scripts local text = plr.PlayerGui.quirklabel.TextLabel if plr.check.Value == 1 then --code end end)