I’ve created a really nice attack using local scripts and everything seemed to be going well until I tested it with a friend. The attacks are only visible to the person who created them. I’ve tried searching for a solution but can’t find any.
Here’s my script:
-- local meteor = game.ReplicatedStorage.MeteorAttack
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runService = game:GetService('RunService')
local RepStorage = game:GetService('ReplicatedStorage')
local MeteorEvent = RepStorage:WaitForChild('Meteor')
mouse.KeyDown:Connect(function(key)
if key == "g" then
local summon = script.Summon
local explosion = script.Explosion
local head = player.Character:FindFirstChild('Head')
local bigmeteor = meteor.Meteor:Clone()
local bomb = bigmeteor.Explosion
local forcefield = bigmeteor.ForcefieldExplosion
local wind = bigmeteor.Circle
local meteoreffect = meteor.Summon:Clone()
local summonpart = meteoreffect
local summonring = meteoreffect.Attachment.ParticleEmitter
local beam = meteor.Beam:Clone()
beam.Transparency = 1
summonring.Enabled = true
meteoreffect.Parent = workspace
beam.Parent = workspace
beam.CFrame = head.CFrame * CFrame.new(0, 1035, 0)
beam.Orientation = Vector3.new(0, 180, -90)
meteoreffect.CFrame = head.CFrame * CFrame.new(0,10,0)
wait(.5)
summon:Play()
player.Character.HumanoidRootPart.Anchored = true
wait(8.5)
local TweenService = game:GetService("TweenService")
beam.Transparency = 0
beam.Size = Vector3.new(2000, 0, 0)
beam.CFrame = head.CFrame * CFrame.new(0, 1035, 0)
beam.Orientation = Vector3.new(0, 180, -90)
local goalbeam = {} --This is the goal for the first tween
goalbeam.Size = beam.Size + Vector3.new(2000, 15, 15)
goalbeam.CFrame = head.CFrame * CFrame.new(0, 1035, 0)
goalbeam.Orientation = Vector3.new(0, 180, -90)
local reverseGoalbeam = {} --This is the goal for the reverse tween
reverseGoalbeam.Size = beam.Size
goalbeam.CFrame = beam.CFrame
goalbeam.Orientation = beam.Orientation
local tweenInfobeam = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false)
local tweenInfo2beam = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
local tweenbeam = TweenService:Create(beam, tweenInfobeam, goalbeam) --This is the first tween
local reverseTweenbeam = TweenService:Create(beam, tweenInfo2beam, reverseGoalbeam)
tweenbeam:Play()
tweenbeam:Play()
summonring.Enabled = false
wait(6.7)
reverseTweenbeam:Play()
bigmeteor.Parent = workspace
bigmeteor:SetPrimaryPartCFrame(head.CFrame * CFrame.new(0,5000,10000))
bomb.Transparency = 1
forcefield.Transparency = 1
wind.Transparency = 1
player.Character.HumanoidRootPart.Anchored = false
local cf = bigmeteor:GetPrimaryPartCFrame()
local hit = mouse.Hit
-- Linear Interpolation
for i = 1, 1000 do --1000
bigmeteor:SetPrimaryPartCFrame(cf:Lerp(hit, i/100))
runService.RenderStepped:Wait()
end
-- Explosion
local smoothness = 25
local explosionradius = 2000
local explosionradius2 = 300
local explosionraidus3 = 350
explosion:Play()
local TweenService = game:GetService("TweenService")
bomb.Transparency = 0
bomb.Size = Vector3.new(explosionradius2, explosionradius2, explosionradius2)
wind.Transparency = 0
wind.Size = Vector3.new(explosionraidus3, explosionraidus3, explosionraidus3)
local goal = {} --This is the goal for the first tween
goal.Size = bomb.Size + Vector3.new(1800, 1800, 1800)
local reverseGoal = {} --This is the goal for the reverse tween
reverseGoal.Size = Vector3.new(50,50,50)
local goal2 = {} --This is the goal for the first tween
goal2.Size = wind.Size + Vector3.new(3500, 250, 3500)
goal2.Transparency = 1
local reverseGoal2 = {} --This is the goal for the reverse tween
reverseGoal2.Size = Vector3.new(50,50,50)
local tweenInfo = TweenInfo.new(7, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false)
local tweenInfo2 = TweenInfo.new(7, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
local tweenInfo3 = TweenInfo.new(7, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false)
local tweenInfo4 = TweenInfo.new(7, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false)
local tween = TweenService:Create(bomb, tweenInfo, goal) --This is the first tween
local reverseTween = TweenService:Create(bomb, tweenInfo2, reverseGoal)
local windtween = TweenService:Create(wind, tweenInfo3, goal2)
local reversewindtween = TweenService:Create(wind, tweenInfo4, reverseGoal2)
tween:Play()
windtween:Play()
wait(6)
runService.RenderStepped:Wait()
reverseTween:Play()
local fadeAwaySmoothness = math.ceil(smoothness * 1.5)
local explosionRadius2 = 8
for i = 1, fadeAwaySmoothness do
local a = i / fadeAwaySmoothness
local size = explosionradius + a * explosionRadius2
game:GetService('RunService').RenderStepped:Wait()
end
wait(10)
meteoreffect:Destroy()
bigmeteor:Destroy()
beam:Destroy()
end
end)
How should I go about fixing this problem?