Hi everyone! I’ve been trying to use a Lightning Module for a lightning beam ability but for some reason the lightning only shows up on the server side and not the client. Does anyone know I can replicate the lightning to all the clients? (would I have to pass NewBolt and NewSparks in to the local script and do something with them there?)
here’s the server script handling all of the lightning:
--SERVER
local Replicated = game:GetService("ReplicatedStorage")
local Remotes = Replicated.Storm
local Fire = Remotes.Lightning
local part1
Fire.OnServerEvent:Connect(function(Player, Value, Mouse)
local Character = Player.Character
local Humanoid = Character.Humanoid
--local Anim = script:FindFirstChild("Animation")
--local AnimPlay = Humanoid:LoadAnimation(AnimFire)
if Value == "On" then
local LightningBolt = require(script.LightningBolt)
local LightningSparks = require(script.LightningBolt.LightningSparks)
part1 = Instance.new("Part")
part1.Transparency = 0.5
part1.CanCollide = false
part1.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2)
part1.Parent = workspace
local weld = Instance.new("WeldConstraint")
weld.Part0 = Character.HumanoidRootPart
weld.Part1 = part1
weld.Parent = part1
local part2 = Instance.new("Part")
part2.Transparency = 0.5
part2.CanCollide = true
part2.Parent = workspace
local a1 = Instance.new("Attachment")
a1.Parent = part1
local a2 = Instance.new("Attachment")
a2.Parent = part2
local beam = Instance.new("Beam")
beam.Attachment0 = a1
beam.Attachment1 = a2
part2.Name = Player.Name.."'s Lightning"
part2.Parent = workspace
part2:SetNetworkOwner(Player)
local NewBolt = LightningBolt.new(a1, a2, 40)
NewBolt.PulseSpeed = 2
NewBolt.Color = Color3.new(0.38117, 0.560006, 1)
local NewSparks = LightningSparks.new(NewBolt)
part2.Touched:Connect(function(touched)
if touched.Parent:FindFirstChild("Humanoid") then
touched.Parent:FindFirstChild("Humanoid"):TakeDamage(0.1)
wait(1)
end
end)
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
Humanoid.JumpHeight = 0
Fire:FireAllClients()
end
if Value == "Off" then
local Trail = workspace:FindFirstChild(Player.Name.."'s Lightning")
if Trail then
Trail:Destroy()
end
part1:Destroy()
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
Humanoid.JumpHeight = 7.2
end
end)
all help would be appreciated