The clone cube that’s following me disappears in the first-person perspective but the original model is still there? I’m not too sure what the problem here is; does it happen to be another visual bug?
Does anyone have a solution? I checked to see if the model needed to be double-sided to appear but that seems to make no difference, so I’m at a loss.
Update: I’m pretty sure this is caused by being parented to the player and disappears with the player as a result. Any suggestions on how to stop that from happening?
Misc. Details
- The model also disappears visually in the wireframe
- Removing the fire doesn’t do anything
Code of following ‘Cube_Pet’:
local pet = script.Parent
function givePet (player)
if player then
local character = player.Character
if character then
local humRootPart = character.HumanoidRootPart
local newPet = pet:Clone ()
newPet.Parent = character
newPet.CanCollide = false
local bodyPos = Instance.new("BodyPosition", newPet)
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local bodyGyro = Instance.new("BodyGyro", newPet)
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
while wait() do
bodyPos.Position = humRootPart.Position + Vector3.new(0, 0, 2)
bodyGyro.CFrame = humRootPart.CFrame
end
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
givePet(player)
end)
end)
YT tutorial code; I’m new but I understand how it works.