So… I am working on a game “Phoenix labs” There are NPCs that when you touch you are meant to die. And I have made a normal touch script on humanoid root part… Didn’t work… Then I tried making a part welded to the root. Still nothing. What should I do?
Make a script inside NPC’s Torso or HumanoidRootPart.
local root = script.Parent --geting part
root.Touched:Connect(function(hit) --if touched
if hit.Parent:FindFirstChildOfClass("Humanoid") then
--if something that touched can die
hit.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(100) --damage 100
end
end)
Did you make custom rigs or maybe players have forcefields?
Well… It has StarterCharacter. and the NPCs have nodes in their model.
you can try using
hit.Parent:BreakJoints()
I This is the script
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild(“Humanoid”)
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
player.PlayerGui.Speech.Enabled = true
script.Parent.Parent.Parent.Humanoid.WalkSpeed = "0"
script.LocalScript:Clone().Parent = player.PlayerGui.Speech.Frame
wait(10)
player.PlayerGui.DeathGuiT.Enabled = true
wait(2)
for i = 1,10 do
wait(.1)
player.PlayerGui.DeathGuiT.Transform.ImageTransparency = player.PlayerGui.DeathGuiT.Transform.ImageTransparency +.1
player.PlayerGui.DeathGuiT.TransformII.ImageTransparency = player.PlayerGui.DeathGuiT.TransformII.ImageTransparency -.1
end
wait(1)
for i = 1,10 do
wait(.1)
player.PlayerGui.DeathGuiT.TransformII.ImageTransparency = player.PlayerGui.DeathGuiT.TransformII.ImageTransparency +.1
player.PlayerGui.DeathGuiT.TransformIII.ImageTransparency = player.PlayerGui.DeathGuiT.TransformIII.ImageTransparency -.1
end
player.PlayerGui.Speech.Frame.Hello.TextLabel.Text = "Darkervoids"
wait(5)
end
end
script.Parent.Parent.Touched:Connect(onTouch)
It should be
script.Parent.Parent.Parent.Humanoid.WalkSpeed = 0
also i never have seen debounce = false,so it won’t work because of that? only once.
…The walkspeed is right.
I just quoted that line in your code.
it shouldnt be “0”, it should be 0 without “”
It always worked with “”.
30 CHARS
Whatever, you script doesn’t have anything about it will kill someone
You didnt even use humanoid:TakeDamage() or humanoid:BreakJoints()
I already wrote script for you, use it instead
It has custom death system with a cutscene.
Your code just changes things in GUI, it doesn’t meant to kill someone.
Yeah… The cutscene is death.
30 chars
So what’s the problem? If everything WORKING with a custom CUTSCENE and DEATH SYSTEM.
The cutscene doesn’t play and there is no bug in output.
Is cutsene a local script inside the main script?
Normal, is that the problem why isn’t it working?
if you are doing anything to players camera you should use localscript(not always)
local camera = workspace.CurrentCamera