i want to make a ball, the problem is the ball aint smooth and it dosent respect the lookvector, i want it to be like kick off, current code
local whohasball = nil
local hitboxmodule = require(game:GetService("ServerScriptService").HitboxModuleMain)
script.Parent.Touched:Connect(function(hit)
hit = hit.Parent
if hit:FindFirstChild("Humanoid") ~= nil and not (whohasball == hit.Name) then
whohasball = hit.Name
script.Parent.Anchored = true
game:GetService("RunService").Heartbeat:Connect(function()
script.Parent.Position = Vector3.new(hit["Left Leg"].Position.X+1,1,hit["Left Leg"].Position.Z+1)
end)
end
end)
You are using position which is global so it would only look correct from one direction. Using CFrames relates to the orientation of the ball. So I would do this
local whohasball = nil
local hitboxmodule = require(game:GetService("ServerScriptService").HitboxModuleMain)
script.Parent.Touched:Connect(function(hit)
hit = hit.Parent
if hit:FindFirstChild("Humanoid") ~= nil and not (whohasball == hit.Name) then
whohasball = hit.Name
script.Parent.Anchored = true
game:GetService("RunService").Heartbeat:Connect(function()
script.Parent.CFrame = script.Parent.CFrame + ((hit["Left Leg"].CFrame.LookVector * 1) + Vector3.new(0,1,0)
end)
end
end)
local TS = game:GetService("TweenService")
script.Parent.Touched:Connect(function(hit)
hit = hit.Parent
if hit:FindFirstChild("Humanoid") ~= nil and not (whohasball == hit.Name) then
script.Parent.Anchored = true
local EndCF = ((hit["Left Leg"].CFrame.LookVector * 100) + Vector3.new(0,75,0)
local EndVector = EndCF.Position
local Tween = TS:Create(script.Parent,TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0),{Position = EndVector})
Tween:Play()
wait(2)
Tween:Destroy()
end
end)
But wouldn’t that just play the tween once? Also it kind of breaks touched, so if another person touched the ball from another player he would need to get real close