What do you want to achieve? Keep it simple and clear!
I made this script that gives a hat when touch a part it works very well, but i want to know if have any method to
Save Player Hats/Accessory
Remove old hats
Give the new hat (UnicornHood)
Wait 10 seconds
Remove UnicornHood
And gives the player hats/accessory back
What is the issue? Include screenshots / videos if possible!
I dont found anything for help me on Developer.Roblox website
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes.
local hat = game.ServerStorage.Hats.UnicornHood
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not hit.Parent:FindFirstChild("UnicornHood") then
hat:Clone().Parent = hit.Parent
end
end
end)
local hat = game.ServerStorage.Hats.UnicornHood
local hats = {}
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not hit.Parent:FindFirstChild("UnicornHood") then
local hum = hit.Parent.Humanoid
hats = hum:GetAccessories()
hum:RemoveAccesories()
local clone = hat:Clone()
clone.Parent = hit.Parent
wait(10)
clone:Destroy()
for _,v in pairs(hats) do
hum:AddAccessory(v)
end
end
end
end)
local hat = game.ServerStorage.Hats.UnicornHood
local hats = {}
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not hit.Parent:FindFirstChild("UnicornHood") then
local hum = hit.Parent.Humanoid
for _,v in pairs(hum:GetAccessories()) do
table.insert(hats, v:Clone())
end
hum:RemoveAccesories()
local clone = hat:Clone()
clone.Parent = hit.Parent
wait(10)
clone:Destroy()
for _,v in pairs(hats) do
hum:AddAccessory(v)
end
end
end
end)
local hat = game.ServerStorage.Hats.UnicornHood
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not hit.Parent:FindFirstChild("UnicornHood") then
local hum = hit.Parent.Humanoid
local hats = {}
for _,v in pairs(hum:GetAccessories()) do
table.insert(hats, v:Clone())
end
hum:RemoveAccesories()
local clone = hat:Clone()
clone.Parent = hit.Parent
wait(10)
clone:Destroy()
for _,v in pairs(hats) do
hum:AddAccessory(v)
end
end
end
end)
Anytime! Excuse me for all the mess ups I made, I really gotta look my code carefully haha. If you have anymore issues don’t be afraid to make another post!