So I’m making a game and I’m trying to make a script that when a player types “!afk”
it will put a billboard GUI over there head.
heres the what I tried making
local CLONE = script.AFKGui:Clone()
game.Players.PlayerAdded:Connect(function(Player)
local PlayerAFK = false
Player.Chatted:Connect(function(Message)
if Message == "!afk" then
if PlayerAFK == false then
PlayerAFK = true
local ForceField = Instance.new("ForceField", Player.Character)
CLONE = Player.Character.Head
else
PlayerAFK = false
Player.Character.ForceField:Destroy()
Player.Character.Humanoid.DisplayName = Player.Name
end
end
end)
end)
Edit: i tried putting this in lighting and server script server but it just says nothing and it wont appear
You’re setting a variable CLONE as the Player’s head. Instead, treat it like an object. Example: CLONE.Parent = Player.Character.Head
^ this also wouldn’t display an error as there is nothing internally wrong with this script, it just does two different actions.
its a script not a local script and its a billboard gui and I’m trying to put it above the users head but it doesn’t spit out an error and i put the billboard gui inside of the script
I think the reason is that the script is the Server Script Service is not inside of the GUI, I think you are trying to find something that isn’t in the scripts “kids”.
I wouldn’t recommend putting this in StarterCharacterScripts. Scripts within StarterCharacterScripts will not reappear in the character if the character is destroyed (meaning the player dies and has to respawn).
Also, I wouldn’t, but the BillboardGUI inside of the script. I’d put the script in the BillBoardGUI, then put the GUI in something like ServerStorage or StarterGui. You’d have to change your CLONE variable to script.Parent.
Finally, make sure to set the Adornee property to the character’s head. Setting the parent to the head I don’t think is enough.