I am trying to make a ball that when you click it, it throws the ball, simple as that. However, the ball model I use is quite old and I guess since the physics of ROBLOX have updated, has made this ball outdated. For example, everytime the user tries to shoot the ball, it does not shoot towards the desired direction. The script is as follows:
Tool = script.Parent
function fire(v) Tool.Handle.Boing:play() local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local spawnPos = vCharacter.PrimaryPart.Position spawnPos = spawnPos + (v * 5)
Tool.Parent = game.Workspace Tool.Handle.Position = spawnPos rand= (math.random(33,37)) --a range between two numbers print(rand) Tool.Handle.Velocity = v * rand
end
function onActivated() local character = Tool.Parent; local humanoid= character.Humanoid local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit fire(lookAt) end
Tool.Activated:connect(onActivated)