I'm messing around with BodyPosition and BodyGyros with stands, but when I'm cloning the model to put into a folder of stands for the player to move, it only has a Humanoid in it, I have 0 clue why this is happening.
I have a bit of a feeling that it has to do with that I'm giving the Player network ownership over the stand's PrimaryPart (HumandRootPart), and then in a LocalScript, modifying the BodyPosition and BodyGyros, but honestly have no clue.
Server:
local Stand = game:GetService("ReplicatedStorage")["The World OVA"]
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
function PlayerDied(Player)
Player:FindFirstChild(Player.Name .. "'s Stand"):Destroy()
RemoteEvent:FireClient(Player, false)
end
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message:lower() == "stand" and Player.Character then
local Humanoid = Player.Character.Humanoid
local New = Stand:Clone()
Humanoid.Died:Connect(PlayerDied)
local BodyP = Instance.new("BodyPosition")
local BodyG = Instance.new("BodyGyro")
BodyP.P = math.huge
BodyP.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BodyP.D = 200
BodyG.P = math.huge
BodyG.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
BodyP.Parent = New.HumanoidRootPart
BodyG.Parent = New.HumanoidRootPart
New.Name = Player.Name .. "'s Stand"
New.Parent = workspace.Stands
Player.Character.ChildAdded:Wait()
New.PrimaryPart:SetNetworkOwner(Player) -- So they can do stuff.
RemoteEvent:FireClient(Player, New)
end
end)
end)
Client:
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local Player = game:GetService("Players").LocalPlayer
local STAND_OFFSET = CFrame.new(-3,0,2) -- Will mess around with this.
local TrackingStand = nil
local Heartbeat
local function UpdateStand()
if Player.Character and Player.Character["HumanoidRootPart"] then
local BodyP = TrackingStand.HumanoidRootPart.BodyPosition
local BodyG = TrackingStand.HumanoidRootPart.BodyGyro
local RootPart = Player.Character.HumanoidRootPart
BodyP.Position = (RootPart.CFrame * STAND_OFFSET).p
BodyG.CFrame = RootPart.CFrame
end
end
local function ClientEvent(Argument)
if Argument == false then
Heartbeat:Disconnect()
else
TrackingStand = Argument
Heartbeat = game:GetService("RunService").Heartbeat:Connect(UpdateStand)
end
end
RemoteEvent.OnClientEvent:Connect(ClientEvent)
Any help is appreciated.
