I got a script where I throw a ball but it’s a local script and I would like it to become a server script.
I tried to convert local player = game.Players.LocalPlayer
to the Player Added function to get mouse but it seems to not be working.
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local mouse = player:GetMouse()
local handle = script.Parent.Handle
local debounce = false
local track
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://11440701567"
script.Parent.Activated:Connect(function()
if not debounce then
debounce = true
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
script.Parent.Boing:Play()
local Handle = handle:Clone()
Handle.Parent = workspace
Handle.CFrame = Handle.CFrame * CFrame.new(0, 2, 0)
Handle.Trail.Enabled = true
local direction = mouse.Hit.LookVector
local forceMultipliter = 250 * Handle:GetMass()
Handle:ApplyImpulse(direction * forceMultipliter)
wait(0.25)
debounce = false
end
end)
I only need help to convert the ball throwing part.