The script you gave me has one error in terms of scripting but also another error in terms of the game's functionality.
For quite a long time now ROBLOX has strongly recommended and almost enforced players to have FilteringEnabled (FE) in their game, and for a good reason. It prevents exploiters from changing the server through the client. Your script will not work with an FE game.
The first error comes in line 2
local clonedgui = game.Workspace.ServerStorage.CatTeam:Clone()
ServerStorage is a service; it can only be accessed using the DataModel/GetService method. I'm assuming this is what you're trying to access and not a Model or Folder you created in Workspace you named "ServerStorage". If that's the case, carry on...
Otherwise, here's the correct method you should use:
local serverStorage = game:GetService("ServerStorage")
local clonedgui = serverStorage:FindFirstChild("CatTeam"):Clone()
Now let's talk about the real issue: you're trying to do this from the client. This will not work through the client since ServerStorage doesn't replicate its contents to the client and therefore it can't be accessed. You could potentially use ReplicatedStorage which replicates its contents to both client and server. However, the only player who would be able to see it would be the one who ran the script.
Therefore, if we want all players to see it, we must first inform the server of this and request a change. To do this we can either use a RemoteFunction or a RemoteEvent
Let me try to guide you through how we would approach this.
First, create a Script in ServerScriptService. Inside that script put in the script below. I've commented it thoroughly so you have an idea of what is going on.
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = "CloneOverheadGui"
remoteEvent.Parent = replicatedStorage
local overheadGui = serverStorage:FindFirstChild("CatTeam")
remoteEvent.OnServerEvent:Connect(function(player)
local character = player.Character
if character then
local head = character:FindFirstChild("Head")
if head then
local clonedgui = overheadGui:Clone()
clonedgui.Parent = head
end
end
end)
Then, inside the LocalScript, paste this code in. It's fairly simple now that the server is handling the rest.
local replicatedStorage = game:GetService("ReplicatedStorage")
local overheadRE = replicatedStorage:WaitForChild("CloneOverheadGui")
script.Parent.MouseButton1Click:Connect(function()
overheadRE:FireServer()
end)
If you have any questions let me know. Hope this helps you.
Happy developing!