i am trying to implement a feature in this ServerScript stored in a tool to update the camera to the “Tpart”
wait()
local tool = script.Parent
local plr = script.Parent.Parent.Parent
Value = script.Parent.Value
local phys = game:GetService(“PhysicsService”)
local ballgroup
local success1 = pcall(function() ballgroup = phys:GetCollisionGroupId(“ball”) end)
if not success1 then phys:CreateCollisionGroup(“ball”) ballgroup = phys:GetCollisionGroupId(“ball”) end
local playergroup
local success2 = pcall(function() playergroup = phys:GetCollisionGroupId(“players”) end)
if not success2 then phys:CreateCollisionGroup(“players”) playergroup = phys:GetCollisionGroupId(“players”) end
phys:CollisionGroupSetCollidable(“ball”,“players”,false)
local tpart = Instance.new(“Part”)
tpart.Size = Vector3.new(1.5,1.5,1.5)
tpart.Shape = “Ball”
tpart.CollisionGroupId = ballgroup
tpart.Parent = game.Workspace.Balls
for _,v in pairs(plr.Character:GetChildren()) do
if v:IsA(“BasePart”) then
v.CollisionGroupId = playergroup
end
end
tool.Activated:Connect(function()
print(Value.Value)
local pos = script.Parent.RemoteFunction:InvokeClient(plr)
local Part = tpart:Clone()
Part.Position = plr.Character.RightHand.CFrame.p
Part.Velocity = CFrame.new(plr.Character.RightHand.CFrame.p,pos):vectorToWorldSpace(Vector3.new(0,0.25,-Value.Value)) * 200
Part.Parent = workspace
end)
this is the script