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

How do i make a touch event ono the drooling zombie?

Asked by 1 year ago

I have no idea how to do this, i put a script in the drooling zombie model and all the parts like the arms and all but it still doesn't work

I tried to make it so that it jumpscares via replicated storage and debounce is a 5 second timer, I'm just not sure why its not working

` local JumpscareEvent = game.ReplicatedStorage.JScareEvent local Debounce = false

script.Parent.Touched:Connect(function(hit)

if hit.Parent.Head:FindFirstChild("Humanoid") then

    if Debounce == false then
        Debounce = true

        local Player = game.Players:GetPlayerFromCharacter(hit.Parent)

        JumpscareEvent:FireClient(Player)
        wait(5)
        Debounce = false
    end
end

end)`

2 answers

Log in to vote
0
Answered by
OhManXDXD 445 Moderation Voter
1 year ago

You're looking for the Humanoid in the character's head, when you should be looking for it in the character itself.

local JumpscareEvent = game.ReplicatedStorage.JScareEvent
local Debounce = false

script.Parent.Touched:Connect(function(hit)
  if hit.Parent:FindFirstChild("Humanoid") then
    if Debounce == false then
      Debounce = true

      local Player = game.Players:GetPlayerFromCharacter(hit.Parent)

      JumpscareEvent:FireClient(Player)
      wait(5)
      Debounce = false
    end
  end
end)
0
I dont think this works, i put the script in the zombie but its not working, it says this in output 11:11:27.175 Touched is not a valid member of Model "Workspace.LockedRoom.Zombie" - Server - Script:4 RICHKINGREMMIXCLUB 0 — 1y
Ad
Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

Place the script inside a basepart of the zombie, or change script.Parent to script.parent:FindFirstChild().

TBH i would recommend making an invisible Hitbox and weld it to the humanoidrootpart of the zombie

Touched is an event of 'BaseParts', not models.

Also, the Humanoid exists as a child of the model itself, not the head.

local jumpscareevent = game.ReplicatedStorage.JScareEvent -- path to event here

local hitbox = script.Parent:FindFirstChild("Hitbox") --put your path to hitbox here
local cd = --your cd
local debounce = false

hitbox.Touched:Connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
    debounce = true
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

    jumpscareevent:FireClient(plr)
    task.wait(cd)
    debounce = false
end)

Answer this question