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

How can I make this lightning bolt script work in the client?

Asked by
Cikeruw 14
2 years ago

My script is in the client and when it is in the client it will only kill players on my screen. How can I make it so that players can see the lightning bolt and kill the players?

local UIS = game:GetService("UserInputService")
local Tool = script.Parent
local Debounce = false
local Part = game.ReplicatedStorage.Wedge
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Up:Connect(function()
    if Tool.Parent.Name == Player.Character.Name then
    local partclone = Part:Clone()
        partclone.CanCollide = false
        partclone.CFrame = Player.Character.HumanoidRootPart.CFrame
    local Vel = Instance.new("BodyVelocity",partclone)
    Vel.MaxForce = Vector3.new(10000,10000,10000)
    Vel.Velocity = Mouse.Hit.LookVector * 300
        partclone.Parent = game.Workspace
        partclone.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("Humanoid")then
                if hit.Parent.Name == Player.Character.Name then
                    wait()
                else
                if not Debounce then 
                    Debounce = true
                end
                hit.Parent:FindFirstChild("Humanoid").Health = hit.Parent:FindFirstChild("Humanoid").Health - 5 * Player.leaderstats.Level.Value
                wait(5)
                    Debounce = false
                end
            end
        end)
    end
end)

2 answers

Log in to vote
0
Answered by 2 years ago

Found the Issue, you where using BodyVelocity, Its Deprecated meaning It stills works, just not on new work, try using VectorForce Instead

Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question