Here is some code that I’m confused about. I don’t know exactly why it isn’t working. It worked before I was deciding to leave it in ServerStorage intending for a use of others later, once this issue is fixed.
There are no errors at all for some reason, but it’s not working.
local cloned = game.ServerStorage["Meshes/ship2 (2)"]:Clone()
cloned.Name = "Ship"
cloned.Parent=workspace
local PetPos = Instance.new("BodyPosition", cloned)
local PetGyro = Instance.new("BodyGyro", cloned)
PetGyro.MaxTorque = Vector3.new(400000,400000,400000)
local Owner = 'Derpee_Kirbee'
while (1) do
wait()
local OwnerObj = workspace:WaitForChild(Owner)
local OwnerPos = OwnerObj.HumanoidRootPart.Position
local StopAt = ((OwnerPos - cloned.Position).magnitude - 5) * 1000
PetPos.P = StopAt
PetPos.Position = OwnerPos + Vector3.new (0,10,0)
PetGyro.CFrame = OwnerObj.HumanoidRootPart.CFrame
end
local cloned = game.ServerStorage["Meshes/ship2 (2)"]:Clone()
cloned.Name = "Ship"
cloned.Parent=workspace
local PetPos = Instance.new("BodyPosition", cloned)
local PetGyro = Instance.new("BodyGyro", cloned)
PetGyro.MaxTorque = Vector3.new(400000,400000,400000)
local Owner = 'Derpee_Kirbee'
while true do
wait(1)
local OwnerPlayer = game.Players:FindFirstChild(Owner)
if OwnerPlayer ~= nil then
local OwnerCharacter = OwnerPlayer.Character or OwnerPlayer.CharacterAdded:Wait()
if OwnerCharacter ~= nil then
local OwnerPos = OwnerCharacter.HumanoidRootPart.Position
local StopAt = ((OwnerPos - cloned.Position).magnitude - 5) * 1000
PetPos.P = StopAt
PetPos.Position = OwnerPos + Vector3.new(0,10,0)
PetGyro.CFrame = OwnerCharacter.HumanoidRootPart.CFrame
end
end
end
Can’t help you much without any errors or a studio file, you can make a file and upload it
try this…
local cloned = game.ServerStorage["Meshes/ship2 (2)"]:Clone()
cloned.Name = "Ship"
cloned.Parent=workspace
local PetPos = Instance.new("BodyPosition", cloned)
local PetGyro = Instance.new("BodyGyro", cloned)
PetGyro.MaxTorque = Vector3.new(400000,400000,400000)
local Owner = 'Derpee_Kirbee'
while true do
wait(1)
local OwnerPlayer = game.Players:FindFirstChild(Owner)
if OwnerPlayer ~= nil then
local OwnerCharacter = OwnerPlayer.Character or OwnerPlayer.CharacterAdded:Wait()
if OwnerCharacter ~= nil then
local OwnerPos = OwnerCharacter.HumanoidRootPart.Position
local StopAt = ((OwnerPos - cloned.Position).magnitude - 5) * 1000
PetPos.P = StopAt
PetPos.Position = OwnerPos + Vector3.new(0,10,0)
PetGyro.CFrame = OwnerCharacter.HumanoidRootPart.CFrame
else
print("OwnerCharacter is nil")
end
else
print("OwnerPlayer is nil")
end
end
If @kylerzong has solved your problem, it would be nice of you to mark his response as the “Solution”. You can locate that button directly under his response.