why is projectile not going to the location of my mouse?[Solved]
Asked by
6 years ago Edited 6 years ago
---local script
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local input = game:GetService("UserInputService")
local remote = game.ReplicatedStorage.Mera4
local Mouse = plr:GetMouse()
local db = true
if game.Players.LocalPlayer.PlayerGui.Waitmove:WaitForChild("FireBall")then
input.InputBegan:Connect(function(key, gameprocced)
if key.KeyCode == Enum.KeyCode.T and not gameprocced then
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=02626118289"
local animtrack = game.workspace[plr.Name].Humanoid:LoadAnimation(anim)
animtrack:Play()
remote:FireServer(Mouse.Hit, db)
wait(2)
db = false
end
end)
end
--- server script
local remote = game.ReplicatedStorage.Mera4
remote.OnServerEvent:Connect(function(plr,char,Mouse,db)
local dmg = false
db = true
local FP = game.ReplicatedStorage.BF:Clone()
FP.Parent = plr.Character["Right Arm"]
local Kew = game.ReplicatedStorage.BFF:Clone()
Kew.Parent = plr.Character["Right Arm"]
local aa = game.ReplicatedStorage.BFFF:Clone()
aa.Parent = plr.Character["Right Arm"]
local nn = game.ReplicatedStorage.BFFFF:Clone()
nn.Parent = plr.Character["Right Arm"]
local eee = game.ReplicatedStorage.BFFFFF:Clone()
eee.Parent = plr.Character["Right Arm"]
local fefe = game.ReplicatedStorage.BFB:Clone()
local par = Instance.new("Part")
par.Transparency = 0
par.CanCollide = false
par.Anchored = true
wait(1)
plr.Character.Torso.Anchored = true
par.Shape = "Ball"
par.Size = Vector3.new(20,20,20)
par.CFrame = plr.Character.Torso.CFrame * CFrame.new(0,25,0)
par.TopSurface = "Smooth"
par.BackSurface = "Smooth"
local eo = Instance.new("Smoke")
eo.Size = 30
eo.Color = Color3.new("Grey")
eo.Parent = par
par.BrickColor = BrickColor.new("Bright orange")
par.Material = "Neon"
par.Parent = game.Workspace
Kew.Parent = par
aa.Parent = par
nn.Parent = par
eee.Parent = par
wait(0.250)
par.Size = Vector3.new(21,21,21)
wait(0.250)
par.Size = Vector3.new(23,23,23)
wait(0.250)
par.Size = Vector3.new(25,25,25)
wait(0.250)
par.Size = Vector3.new(27,27,27)
wait(0.250)
par.Size = Vector3.new(28,28,28)
wait(0.250)
par.Size = Vector3.new(30,30,30)
wait()
plr.Character.Torso.Anchored = false
par.Anchored = false
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = Mouse.lookVector----par.Position = CFrame.new(plr.Character.Torso.Position,pos)
BV.Parent = par
fefe.Parent = par
wait()
par.CFrame = plr.Character.Torso.CFrame * CFrame.new(0,15,0)
wait(0.250)
plr.Character["Right Arm"].Transparency = 0.8
par.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hit.Parent:FindFirstChild("Humanoid") == nil then return end
if dmg == false then
dmg = true
if hum.Parent == char then
hum.Health = hum.Health - 0
else
hum.Health = hum.Health - 70
end
end
end)
wait(4)
plr.Character["Right Arm"].Transparency = 0
FP:Destroy()
par:Destroy()
db = false
end)