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

Pet Script positioning/rotating problems?

Asked by 8 years ago
Edited 8 years ago
game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        --
        local firefly = Instance.new("Part", game.Workspace)
        firefly.Size = Vector3.new(2,2.4,2)
        firefly.Transparency = 0.5
        firefly.CanCollide = false
        firefly:BreakJoints()
        firefly.Name = plr.Name .. "'s Firefly"
        --
        local bp = Instance.new("BodyPosition", firefly)
        bp.maxForce = Vector3.new(math.huge,math.huge,math.huge)

        --
        while wait() do
            bp.position = Vector3.new(char.Torso.Position.X,char.Torso.Position.Y -1,char.Torso.Position.Z +4)
            if char.Humanoid.Health < 1 then
                firefly:remove()
            end
        end
    end)
end)

So this scripts creates a brick and it follows the player, however it always seems to follow on the same axis (hard to explain) and never rotates with the player(so how would I do that). Also how would I make It so this brick always pings back to the right side of the player? would I create a brick that is welded to the player to the right so the brick has a target position? I don't know , any help would be much appreciated thanks :)

1 answer

Log in to vote
0
Answered by 8 years ago

This is a snippet from my own pet script I have, maybe this will help.

local bg=Instance.new("BodyGyro", v)
bg.MaxTorque=Vector3.new(math.huge,math.huge,math.huge)
local bp=Instance.new("BodyPosition", v)
bp.MaxForce=Vector3.new(math.huge,math.huge,math.huge)
while rs:wait() do --game:GetService("RunService").RenderStepped
    bp.Position=player.Character.Head.CFrame*CFrame.new(2,.5,0).p
    bg.CFrame=player.Character.Head.CFrame
    bg.CFrame=bg.CFrame*CFrame.Angles(0,0,0)
    bp.D=515
end
0
thanks man! this actually helped more than you'd think ahah, much appreciated! Bubbles5610 217 — 8y
0
No problem. It was most likely the absence of BodyGyro, which made the rotation all wacky, lol. SimplyRekt 413 — 8y
Ad

Answer this question