Get player character and clone it?
This is a script that is in a Model, it's supposed to get the player's character which is in a StringValue and clone it and put it in another model. However, line 11 / 12 throws an error. Does anyone know how do I get around or fix this?
01 | local eotd = game.ReplicatedStorage.EOTD |
03 | eotd.Changed:connect( function () |
04 | if eotd.Value ~ = nil then |
05 | local model = script.Parent [ "Employee Of The Day" ] |
06 | local player = game.Workspace:FindFirstChild(eotd.Value) |
07 | for i, v in pairs (model:GetChildren()) do |
10 | local character = game.Players [ eotd.Value ] .Character |
11 | character:Clone().Parent = script.Parent [ "Employee Of The Day" ] |
12 | print ( 'NAC: Value changed' ) |
13 | model:WaitForChild( 'Humanoid' ).MaxHealth = 0 |
14 | model.Humanoid.Health = 0 |
15 | model.Health:Destroy() |
16 | for i, v in pairs (model:GetChildren()) do |