You are on the right track. Something you can try is to make a server script in serverscriptservices that says the following:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
end)
end)
This script will destroy any accessories the player has when its character is reloaded, such as when the player dies. If you want it for only when the player joins you'd revise the script:
game.Players.PlayerAdded:Connect(function(plr)
local changed = Instance.new("BoolValue")
changed.Parent = plr
changed.Name = "IsDifferent"
changed.Value = false
plr.CharacterAdded:Connect(function(char)
if plr.IsDifferent.Value == false then
for i,v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
plr.IsDifferent.Value = true
end
end)
end)
I hope this answers your question
Edit:
I have found the solution! There is a tutorial provided by roblox right here on how to do this. You'll have to scroll down a bit but it is there. You can edit this script using the suggestions I provided before.
1 comment
Note: the local script is in StarterCharacterScripts