This script puts a cop from ServerStorage into the workspace then sets a variable and then if the variable is 1 it loops a if statement that is the cops health is less then 100 it puts it back in ServerStorage and heals it.
local cop = game.ServerStorage.Fgt local p = 0 local function onClicked(hit) p = 1 hit.PlayerGui.ScreenGui.ThreatLevel.Text = "Caution!" cop.Parent = game.Workspace wait(8) hit.PlayerGui.ScreenGui.ThreatLevel.Text = "No Threat" end game.Workspace.fgtbutton.ClickDetector.MouseClick:connect(onClicked) if p == 1 then while true do if game.workspace.Fgt.Humanoid.Health <100 then game.workspace.Fgt.Humanoid.Health = 100 game.workspace.Fgt.Parent = game.ServerStorage end end end
That is my problem it doesn't move it or heal it ?
I think the problem lays in the "while true do" part but I am a beginner scripter, so I need help to figure why it does this ?

4 comments
Try this, and next time, use the LUA box thing...
Yeah sorry about not useing Lua Box
If it worked, press "Accept Answer"
*Code Block