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

I am attempting to equip a players hat when they enter the game. Ideas?

Asked by 4 years ago

I am attempting to make a script that adds a hat to the players charcater depending on their last play through. I currently have the value of the currentequippedhat set to 1 as default so it is not a data issue. I get the "not functioning" option in the output instead of printing whats inside the first if statement. What do you guys suggest?


local equipEvent = game:GetService("ReplicatedStorage").RemoteEvents.EquipHat local BasicFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BasicFedora local BlackStripedFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BlackStripedFedora local GreenFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.GreenFedora local FancyFedora = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.FancyFedora local BaseballCap = game:GetService("ReplicatedStorage"):WaitForChild("Items").Hats.BaseballCap game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if player:WaitForChild("leaderstats"):WaitForChild("PlayerStats").CurrentEquippedHat.Value == 1 then print("Hat 1 is equipped") char.Humanoid:RemoveAccessories() char.Humanoid:AddAccessory(BasicFedora:Clone()) else print("not functioning") end end) end)

2 answers

Log in to vote
0
Answered by
Rynappel 212 Moderation Voter
4 years ago

Go to the Home tab on roblox studio and on the right you will see a button that says Game Settings click on that and click the Avatar tab, you will see many options for the players avatar, have fun!!

0
-1 , a constant hat isn't going to help at all in the case of a saving and loading hat load system. Gojinhan 353 — 4y
0
no need to be rude and down vote the question ;-; Rynappel 212 — 4y
Ad
Log in to vote
-1
Answered by
Gojinhan 353 Moderation Voter
4 years ago

Instead of doing character:AddAccessory() just parent the accesory to the players character like this:

    print("Hat 1 is equipped")
                char.Humanoid:RemoveAccessories()
                    BasicFedora:Clone().Parent = char
            else
                print("not functioning")
            end

0
-1, payback cause your rude Rynappel 212 — 4y
0
oh no, i downvoted your answer because it didn't help at all, i'm such a horrible person huh Gojinhan 353 — 4y
0
yours didnt help at all ;-; Rynappel 212 — 4y

Answer this question