Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Pet not rotating?

Asked by
yoshi8080 445 Moderation Voter
9 years ago

Made a little pet script, however, it won't be able to rotate.

01local plr = game.Players.LocalPlayer
02local char = plr.CharacterAdded:wait()
03    torso = char:WaitForChild('Torso')
04local ServerStorage = game:GetService('ServerStorage')
05 
06    Pets = ServerStorage:WaitForChild('Pets')
07    dog = Pets:WaitForChild('Annoying Dog')
08    oldrot = Vector3.new(90,180,90) -- Rotation
09 
10    dog.Parent = char
11 
12        Gyro = Instance.new('BodyGyro',dog)
13            while wait() do
14                Gyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
15                    oldpos = torso.CFrame * CFrame.new(0,-2,-4)
16                        dog.Rotation = Vector3.new(90,180,90)
17                        dog.Rotation = oldrot
18                        dog.CFrame = oldpos
19                Gyro.CFrame = torso.CFrame
20                                                end

It works, just rotation property of part isn't working. pet is a union

1 answer

Log in to vote
1
Answered by
XAXA 1569 Moderation Voter
9 years ago

It seems like you want the dog to hover around the player's head.

Use a combination of BodyPositions and BodyGyros.

01local plr = game.Players.LocalPlayer
02local char = plr.CharacterAdded:wait()
03local torso = char:WaitForChild('Torso')
04local head = char:WaitForChild('Head')
05local ServerStorage = game:GetService('ServerStorage')
06 
07local Pets = ServerStorage:WaitForChild('Pets')
08local dog = Pets:WaitForChild('Annoying Dog')
09 
10local newpet = dog:Clone()
11newpet.Parent = workspace
12 
13local bgyro = Instance.new('BodyGyro', newpet)
14bgyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
15 
View all 23 lines...
Ad

Answer this question