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

Custom team script doesn't work if in the real game?

Asked by
Hydrogyn 155
7 years ago

Hi, there!

I have a problem, Script will work in studio and not in the real game.

--// This is a localscript!
local bill = game:GetService("ServerStorage"):WaitForChild("crobras")

script.Parent.MouseButton1Down:connect(function()
 local plr = game:GetService("Players").LocalPlayer.Character
 local clonedgui = bill:Clone()

print("works")
clonedgui.Parent = game.Workspace[plr.Name].Head
script.Parent.Parent:Destroy()
end)


Need help! :)

0
press f9 in real game mode to find any errors lurking around greatneil80 2647 — 7y
0
Already did that like 5,000 times! Hydrogyn 155 — 7y
0
Why do you think you can get to ServerStorage from the client (localscript)? GoldenPhysics 474 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Server Storage only goes to the server, like the name implies. Instead, use ReplicatedStorage. Also, READ MY BIO!

Ad
Log in to vote
0
Answered by
Bazuxk 95
7 years ago
Edited 7 years ago

Okay, so I guess you're trying to make a custom name ontop of the player's head by clicking a GUI.

To me, it's easier by putting the BillboardGui somewhere inside the ScreenGui. BillboardGui only works when it's inside a Part

This is the recreated version of your script:


-- this local script must be inside ScreenGui local plr = game.Players.LocalPlayer local b1 = script.Parent.Parent:WaitForChild('BillboardGui') script.Parent.MouseButton1Click:connect(function() local b2 = plr.Character.Head:FindFirstChild('BillboardGui') if b2 then -- if the Billboard is already inside, it will destroy and replace the new one b2:Destroy() wait(.1) b1:Clone().Parent = plr.Character.Head print('cloned') else -- if the Billboard isn't inside, it will clone and put inside the player's head b1:Clone().Parent = plr.Character.Head print('cloned') end end)
Log in to vote
0
Answered by 7 years ago

LocalScript, using ServerStorage? You see what doesn't work there?

Answer this question