so i tried to make something like, when you die , your parts will disappear and soul will come one and shatter. i tried this script:
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
Player.Character.Humanoid.Died:connect(function()
local char = Player.Character
local d = game.ReplicatedStorage.Death.Soull:Clone()
local c = game.ReplicatedStorage.Death.HalfHeart:Clone()
d:SetPrimaryPartCFrame(CFrame.new(char.HumanoidRootPart.Position.X,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
c:SetPrimaryPartCFrame(CFrame.new(d.PrimaryPart.Position.X,d.PrimaryPart.Position.Y,d.PrimaryPart.Position.Z))
for _,Part in next, Player.Character:children() do
if Part:IsA('BasePart') or Part:IsA('Accessory') or Part:IsA('Model') or Part:IsA('Tool') or Part:IsA('Hat') then
Part:Destroy()
end
d.Parent = workspace
wait(2)
d:Destroy()
c.Parent = workspace
wait(2)
c:Destroy()
end
end)
end)
end)
the problem is, that the soul’s position is weird and it changes everytime and the human parts won’t disappear, it also gives error
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
Player.Character.Humanoid.Died:connect(function()
local char = Player.Character
local d = game.ReplicatedStorage.Death.Soull:Clone()
local c = game.ReplicatedStorage.Death.HalfHeart:Clone()
d:SetPrimaryPartCFrame(CFrame.new(char.HumanoidRootPart.Position.X,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
c:SetPrimaryPartCFrame(CFrame.new(d.PrimaryPart.Position.X,d.PrimaryPart.Position.Y,d.PrimaryPart.Position.Z))
for _,Part in next, Player.Character:children() do
if Part:IsA('BasePart') or Part:IsA('Accessory') or Part:IsA('Model') or Part:IsA('Tool') or Part:IsA('Hat') then
Part.Transparency = 1
end
d.Parent = workspace
wait(2)
d:Destroy()
c.Parent = workspace
wait(2)
c:Destroy()
end
end)
end)
end)
You are trying to destroy locked parts, that can’t be edited by a script is what the screenshoted error is saying, so just change their transparency to 1.
Also, unlock Soull in replicated storage, there should be a value that says “Locked” or you can put it in workspace and use the lock and unlock tool to unlock it, what the error is actually saying is that it is locked.
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
Player.Character.Humanoid.Died:connect(function()
local char = Player.Character
d:SetPrimaryPartCFrame(CFrame.new(char.HumanoidRootPart.Position.X,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
c:SetPrimaryPartCFrame(CFrame.new(d.PrimaryPart.Position.X,d.PrimaryPart.Position.Y,d.PrimaryPart.Position.Z))
for _,Part in next, Player.Character:children() do
if Part:IsA('BasePart') or Part:IsA('Accessory') or Part:IsA('Model') or Part:IsA('Tool') or Part:IsA('Hat') then
Part.Transparency = 1
end
local d = game.ReplicatedStorage.Death.Soull:Clone()
d.Parent = workspace
wait(2)
d:Destroy()
local c = game.ReplicatedStorage.Death.HalfHeart:Clone()
c.Parent = workspace
wait(2)
c:Destroy()
end
end)
end)
end)
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
Player.Character.Humanoid.Died:connect(function()
local char = Player.Character
d:SetPrimaryPartCFrame(CFrame.new(char.HumanoidRootPart.Position.X,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
c:SetPrimaryPartCFrame(CFrame.new(d.PrimaryPart.Position.X,d.PrimaryPart.Position.Y,d.PrimaryPart.Position.Z))
for _,Part in next, Player.Character:children() do
if Part:IsA('BasePart') or Part:IsA('Accessory') or Part:IsA('Model') or Part:IsA('Tool') or Part:IsA('Hat') then
Part.Transparency = 1
end
local d = game.ReplicatedStorage.Death.Soull:Clone()
wait()
d.Parent = workspace
wait(2)
d:Destroy()
local c = game.ReplicatedStorage.Death.HalfHeart:Clone()
wait()
c.Parent = workspace
wait(2)
c:Destroy()
end
end)
end)
end)
If this does not work, could you send a file of the soull and the halfheart?
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function()
Player.Character.Humanoid.Died:connect(function()
local char = Player.Character
local ds = game.ReplicatedStorage.Death.Soull
local cs = game.ReplicatedStorage.Death.HalfHeart
ds:SetPrimaryPartCFrame(CFrame.new(char.HumanoidRootPart.Position.X,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
cs:SetPrimaryPartCFrame(CFrame.new(ds.PrimaryPart.Position.X,ds.PrimaryPart.Position.Y,ds.PrimaryPart.Position.Z))
for _,Part in next, Player.Character:children() do
if Part:IsA('BasePart') or Part:IsA('Accessory') or Part:IsA('Model') or Part:IsA('Tool') or Part:IsA('Hat') then
Part:Destroy()
end
end
local d = game.ReplicatedStorage.Death.Soull:Clone()
wait()
d.Parent = workspace
wait(2)
d:Destroy()
local c = game.ReplicatedStorage.Death.HalfHeart:Clone()
wait()
c.Parent = workspace
wait(2)
c:Destroy()
end)
end)
end)