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

MaxTorque is not a valid member of BodyPosition Help is something wrong?

Asked by 3 years ago

local PetsFolder = game.ReplicatedStorage:FindFirstChild("PetsFolder") local PetModule = require(game.ServerScriptService.PetModule)

local PlayerUsing = {} local Price = 100

script.Parent.ClickDetector.MouseClick:Connect(function(player) local Character = player.Character

if PlayerUsing[player] == true then return end
PlayerUsing[player] = true

if player.leaderstats.Money.Value >= Price then
    player.leaderstats.Money.Value -= Price

    local PetsTable = {}

    for i, Pet in pairs(PetsFolder:GetChildren()) do
local Rarity = Pet.RarityValue.Value

for i =1, PetModule.Rarities[Rarity] do
    table.insert(PetsTable,Pet)
end

end

local ChosenPet = PetsTable[math.random(1,#PetsTable)] local PetClone = ChosenPet:Clone()

local HatchingGui = player.PlayerGui:WaitForChild("HatchingGui") local EggImage = HatchingGui:FindFirstChild("Frame") EggImage.Visible = true

local Tick = tick() local Timer = 3

while tick() - Tick < Timer do EggImage.Rotation = 8 wait(0.05) EggImage.Rotation = 0 wait(0.05) EggImage.Rotation = -8 wait(0.05) EggImage.Rotation = 0 wait(0.05) end

EggImage.Visible = false local PetImages = HatchingGui:FindFirstChild("Frame").PetImages:FindFirstChild(ChosenPet.Name) PetImages.Visible = true wait(3) PetImages.Visible = false PlayerUsing[player] = false

if player.PetEquipped.Value ~="" and Character:FindFirstChild(player.PetEquipped.Value) then Character:FindFirstChild(player.PetEquipped.Value):Destroy() end

PetClone.Parent = Character player.PetEquipped.Value = PetClone.Name

local BodyPosition = Instance.new("BodyPosition",PetClone.MainPart) BodyPosition.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

local BodyGyro = Instance.new("BodyGyro",PetClone.MainPart) BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

while wait() do BodyPosition.Position = Character.HumanoidRootPart.Position + Vector3.new(2,2,2) BodyGyro.CFrame = Character.HumanoidRootPart.CFrame end end end)

Answer this question