no idea what im doing i tried to write my own code and just got stuck and. have no idea
local function KillPlayer()
game.Workspace.killpart.Touched:Connect
game.Players.
end
someone help xd
no idea what im doing i tried to write my own code and just got stuck and. have no idea
local function KillPlayer()
game.Workspace.killpart.Touched:Connect
game.Players.
end
someone help xd
game.Workspace.killpart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildWhichIsA(“Humanoid”) then
hit.Parent.Humanoid.Health = 0
end
end)
First, please try searching on the Dev Forum or other platforms for help before posting. But, here is what you should do: put a script inside of the part that should kill the player. Then inside of the script type this:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)
--//Variables
local Part = workspace.killpart
--//Functions
Part.Touched:Connect(function(HitPart)
local Humanoid = HitPart.Parent:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Health = 0
end
end)
This piece of code has a lot of missing spaces.
local part = workspace:WaitForChild("KillPart")
part.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid") then
local victimhum = hit.Parent:WaitForChild("Humanoid")
victimhum:TakeDamage(victimhum.MaxHealth)
end
end)