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

how can i add health to a separate humanoid on detection of a replicatedstorage clone?

Asked by 5 years ago
cd = 0



script.Parent.remote.OnServerEvent:Connect(function(Player)
    if cd == 0 then
        cd = 1
        local Bolt = game.ReplicatedStorage.vbolt:Clone()
        Bolt.CFrame = script.Parent.Parent.Handle.CFrame*CFrame.new(0,1,-10)        
        Bolt.Parent = workspace
        Bolt.Velocity = script.Parent.Parent.Handle.CFrame.lookVector * 20
        game.ReplicatedStorage.vampbolt.BodyVelocity.Velocity =         script.Parent.Parent.Handle.CFrame.lookVector*40*2
        script.Parent.Parent.Handle.Sound:Play()
        Bolt.Touched:Connect(function(h)
            local cool = h.Parent:FindFirstChild("Humanoid")
            local alsocool = Player.Parent:FindFirstChild("Humanoid")
            if cool and alsocool then
                alsocool.Health = alsocool.Health + 25
            end
        end)        
        wait(0.6)
        cd = 0
    end
end)

pay your attention to the bottom lines i want the clone to detect a humanoid then add health to the separate humanoid defined in the remoteevent function

0
the variable h was not provided in the code. was this intentional or does the variable not exist? royaltoe 5144 — 5y
0
any errors? royaltoe 5144 — 5y
0
h is the function on touched puwlice 0 — 5y

Answer this question