Hello! I am making a "Little sister" Form bioshock in which when clicked, it will heal you! I think when I use the function: function onClicked(click) That makes the click part of it usable in a script like it is below. I'm not sure what to call that.
function onClicked(click)
local human = click.Parent:findFirstChild("Humanoid")
human.Health = 100
--Below is fine, above is not--
child = script.Parent.Parent
child.Head.Anchored = false
child:FindFirstChild("Left Arm").Anchored = false
child:FindFirstChild("Left Leg").Anchored = false
child.Part.Anchored = false
child:FindFirstChild("Right Arm").Anchored = false
child:FindFirstChild("Right Leg").Anchored = false
child.Torso.Anchored = false
child.Humanoid.Health = 0
child.Name = "LittleSister (Harvested)"
game.Players.LocalPlayer.PlayerGui.HarvestGui.Frame.Visible = true
wait(2)
game.Players.LocalPlayer.PlayerGui.HarvestGui.Frame.Visible = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
The problem is the 'human' part is not found. here is the output: 13:26:50.992 - Workspace.Sister_Vent.LittleSister.Torso.Script:3: attempt to index local 'human' (a nil value) 13:26:50.993 - Stack Begin 13:26:50.994 - Script 'Workspace.Sister_Vent.LittleSister.Torso.Script', Line 3 Any help?
~Minikitkat

2 comments
Thanks! This worked! I had to modify it though. All I needed was the health part I just thought it would be better to see the whole script. Thanks!
I just modified the part where you unanchor all the limbs, what I posted should work but if it didn't then sorry. Have fun coding(: