Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.