Sorry for one question so quickly after the other. In my last question, I was asking how to use AddAccessory properly. Now I've gotten my answer and it works perfectly in Studio, no bugs! However, when I launch a test server and then test it out, I click on the button that the hat comes from and absolutely nothing happens. This has happened before, and it was because I was not Finding First Child or I didn't wait for everything to be identified. Can someone help me quickly identify the thing I need to fix here so it will work in-game? The code is shown below:
function click()
local accessory = game.Lighting.meshes.example:Clone()
local player = game.Players.LocalPlayer
local playercharacter = game.Players.LocalPlayer.Character
local playername = player.Name
local humanoid = game.Workspace:FindFirstChild(playername)
--Hat Equips Here
accessory.Parent = playercharacter
end
script.Parent.MouseButton1Click:connect(click)

5 comments
Oh, my bad! I did mention I was trying to use AddAccessory but in this version of my script I was not. Thank you for the correction, your method seems to work in studio. I'll verify it when it works in-game!
Alright, please tell me if it doesn't. I will be more than happy to help :)
It, unfortunately, does not work in-game either although both work perfectly in studio. I'm so confused.
Does it give you any error in the Developer Console?
Not at all. I press F9 and then click a button that gives the hat, and nothing shows up but the hat is not placed.