In the real server game, anyone can get the first aid kit which is not what I want. I am wanting if their health is lower than 90 then they are allowed to get the kit. It does work in studio though.
script.Parent.ClickDetector.MouseClick:connect(function(Clicker)
Clicker = Clicker.Character
if Clicker.Humanoid.Health <= 90 then
Clicker.Humanoid.Health = Clicker.Humanoid.Health + 30
for i,v in pairs {script.Parent.Parent} do
local Storage = game:GetService("ServerStorage"):WaitForChild("MedKitsStorage")
v.Parent = Storage
wait(60)
v.Parent = game.Workspace:WaitForChild("Storage")
end
end
end)

5 comments
So people who have full health are able to get the medkit as well as people who have health lower than 90?
Yep
Idiot, why are you using the same name that you used for the plr argument, for the players character. Of course it's not going to work.
First, do something about those variables and maybe it'll work.
But the script works in studio... Idiot.