Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- e = Instance.new("RemoteEvent",owner.Character)
- e.Name = "The"
- t = 1
- e.OnServerEvent:Connect(function(_,hit)
- local g = Vector3.new(0, -game.Workspace.Gravity, 0);
- local x0 = owner.Character.HumanoidRootPart.CFrame * Vector3.new(0, 2, -2)
- local v0 = (hit - x0 - 0.5*g*t*t)/t;
- local c = Instance.new("Part");
- c.CanCollide = true;
- c.Size = Vector3.new(5.025, 5.765,6.155)
- c.Shape = "Ball"
- c.CFrame = CFrame.new(x0)
- c.Velocity = v0
- local density = c:GetMass()
- local friction = 1
- local elasticity = 0.25
- local frictionWeight = 10000
- local elasticityWeight = 10000
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- c.CustomPhysicalProperties = physProperties
- c.Parent = script
- local a = Instance.new("Sound",c)
- a.SoundId = "http://www.roblox.com/asset/?id=2320685801"
- a.Volume = 0.5
- a.Looped = true
- a:Play()
- local Mesh = Instance.new("SpecialMesh")
- Mesh.Parent = c
- Mesh.MeshId = "http://www.roblox.com/asset/?id=849882710"
- Mesh.TextureId = "http://www.roblox.com/asset/?id=849882719"
- local function move(target)
- local dir = (target.Position - c.Position).unit
- local spawnPos = c.Position
- local pos = spawnPos + (dir * 1)
- c:ApplyImpulse(CFrame.new(pos, pos + dir).lookVector * -1000)
- end
- local function findNearestTorso(pos)
- local list = game.Workspace:GetChildren()
- local torso = nil
- local dist = 40
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- coroutine.wrap(function()
- temp2 = list[x]
- if (temp2.className == "Model") then
- temp = temp2:findFirstChild("Head")
- human = temp2:findFirstChild("Humanoid")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end
- end
- end
- end)()
- end
- return torso
- end
- coroutine.wrap(function()
- while true do
- local torso = findNearestTorso(c.Position)
- if torso~=nil or c.Velocity.Y < -0.5 then
- a.SoundId = "http://www.roblox.com/asset/?id=2320685801"
- if torso ~= nil then
- move(torso)
- end
- else
- a.SoundId = "http://www.roblox.com/asset/?id=6524411621"
- c:ApplyImpulse(CFrame.new(c.Position,c.Position + c.Velocity).lookVector * -1000)
- end
- task.wait()
- end
- end)()
- end)
- NLS([[
- e = owner.Character:WaitForChild("The")
- mouse = owner:GetMouse()
- owner:GetMouse().Button1Down:Connect(function()
- e:FireServer(mouse.Hit.p)
- end)
- ]],owner.PlayerGui)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement