Skip to content

Commit

Permalink
Set NetworkOwner of player-generated Balls
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewens committed Aug 31, 2023
1 parent 48defda commit db84927
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ServerScriptService/Server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ function Server:initialize(): nil

-- spawn balls when player uses tool
RemoteEvents.NewBall.OnServerEvent:Connect(function(Player, ...)
self:newBall(...)
local Ball = self:newBall(...)
Ball:SetNetworkOwner(Player) -- this makes the physics a lot smoother
end)

-- clear all balls on ClearButton touch
Expand All @@ -126,7 +127,7 @@ function Server:initialize(): nil
end
end)
end
function Server:newBall(position: Vector3, velocity: Vector3, color: Color3): nil
function Server:newBall(position: Vector3, velocity: Vector3, color: Color3): BasePart
--[[
Create a new Ball RBX Instance and add it to the Server, to be put into the QuadTree
]]
Expand All @@ -150,6 +151,8 @@ function Server:newBall(position: Vector3, velocity: Vector3, color: Color3): ni

-- I AM SPEED
Ball.Velocity = velocity

return Ball
end
function Server:clearBalls(): boolean
--[[
Expand Down

0 comments on commit db84927

Please sign in to comment.