Hi, I'm trying to get servers but they're eluding me.
Right now I'm trying to prototype a basketball tool -- it can be held and thrown by the player. It works fine in local testing, but in network testing it breaks -- the ball jumps down a couple units below the player throwing it and then drifts backwards slightly? can't tell what the problem is.
My method of implementation is to have a localscript and serverscript in the ball. the localScript calls a server event that unparents the ball and sets its velocity.
In the localscript:
script.Parent.Activated:Connect(function()
ShootScript.ShootEvent:FireServer()
end)
in the serverscript:
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local lookAt = (humanoid.TargetPoint - character.Head.Position).unit
local vPlayer = game.Players:playerFromCharacter(character)
local spawnPos = character.PrimaryPart.Position + (lookAt * 5)
wait()
Tool.Parent = game.Workspace
Tool.Handle.Position = spawnPos
Tool.Handle.Velocity = (lookAt * script.Parent.PowerValue.Value)+Vector3.new(0,50,0)
Thanks a lot

2 comments
In line 9, it’s GetPlayerFromCharacter, not playerFromCharacter.
Deprecated bvut not the error