Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why wont my instant humanoid.kill script work for my game?

Asked by 3 years ago
local player = game.Players.LocalPlayer
local HumanoidHealth = player.Humanoid.Health
wait(10)
HumanoidHealth = 0

0
You can't allocate properties as pointers, the compiler will simply just store its current value. Instead, use Humanoid.Health = 0. Ziffixture 6913 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

I should be commenting this instead since it's a simple thing, here anyways

local player = game.Players.LocalPlayer
local HumanoidHealth = player.Character.Humanoid.Health
wait(10)
HumanoidHealth = 0

The player is the player, We're getting the character from the player. So player.Character

Ad
Log in to vote
0
Answered by 3 years ago

you forgot to mention the player!:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local HumanoidHealth = character.Humanoid.Health
wait(10)
HumanoidHealth = 0

Answer this question