So basically what i want to do is clone a script into the player. I need to know if a player's health is 0, and if it is then set a value in the player to false. I thought the best way to do that was to clone in a script to detect the player's health, but it isn't inserting. There are no errors
Here is my insert script:
game.Players.Playeradded:Connect(function(player)
local script = game.ReplicatedStorage.Script:Clone()
for i,v in pairs(game.Workspace:GetChildren())do
if v.Name == player.Name then
script.Parent = v
end
end
end)
And here is the script i am inserting
while true do
if script.Parent.Humanoid.Health == 0 then
for i,v in pairs(game.Players:GetChildren())do
if script.Parent.Name == v.Name then
v.Bool.Value = false
end
end
end
wait(3)
end
There might be a more effective way of doing this, i'm not sure. If there is, please tell me!!!
Thanks!

2 comments
There is no need to do this, just put the script you want to insert in the StarterCharacterScripts and it'll work the same
oh ok thanks