****When, I'm In Studio I have My Basketball tool set to when I click and shoot my animation plays. When I Test it the animation works but when I Publish and play Online In-Game the animation doesn't work what am I doing wrong ? Script:
`~~~~~~~~~~~~~~~~~
Tool = script.Parent
shoot = nil
enabled = true
function fire(v)
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local spawnPos = vCharacter.PrimaryPart.Position
spawnPos = spawnPos + (v * 5)
connection:disconnect()
wait()
Tool.Parent = game.Workspace
Tool.Handle.Position = spawnPos
Tool.Handle.Velocity = (v * script.Parent.PowerValue.Value)+Vector3.new(0,50,0)
end
function onActivated()
enabled = false
humanoit = Tool.Parent:FindFirstChild("Humanoid")
torso = Tool.Parent:FindFirstChild("Torso")
shoot = humanoit:LoadAnimation(Tool.animation)
shoot:Play()
enabled = true
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
fire(lookAt)
end
while true do
script.Parent.Activated:wait()
connection = game:service("RunService").Stepped:connect(onActivated)
wait()
end
`

1 comment
Put your code in a code block and tab it correctly as it makes it much easier to read.