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

My block wont orbit the player correctly how fix?

Asked by
ym5a 52
3 years ago
script.Parent.RemoteEvent:FireServer("rem")
local debounce = false
local function Welder(Parent,Part0,Part1)
    local w =Instance.new("WeldConstraint")
    w.Parent = Parent
    w.Part0 = Part0
    w.Part1 = Part1
end
script.Parent.Activated:Connect(function()
    if debounce then return end
    debounce = true
    local player = game.Players.LocalPlayer
    local char = player.Character
    local shroom = script.Parent.Handle
    script.Parent.RemoteEvent:FireServer("eat",char,shroom)
    shroom.Position = char.Head.Position + char.Head.CFrame.LookVector
    wait(5)
    wait(2)
    script.Parent.RemoteEvent:FireServer("putPlr",char,shroom)
    wait(1)
    print("Go!")
    if script.Parent == char then
        player:FindFirstChild("PlayerGui").Hallucination.Enabled = true
        local hal = player:FindFirstChild("PlayerGui").Hallucination
        spawn(function()
            while script.Parent == char do
                print("Hi")
                local t = game.TweenService:Create(hal.Frame,TweenInfo.new(.5),{BackgroundColor3 = Color3.fromHSV(math.random(),1,1)})
                t:Play()
                wait(.5)
            end
        end)
        local root = Instance.new("Part")
        root.CanCollide = false
        root.Anchored = true
        root.Parent = workspace
        root.Size = Vector3.new(2,2,2)
        root.Position = char.HumanoidRootPart.Position
        root.Transparency = 0

        local scare = Instance.new("Part")
        scare.Anchored =false
        scare.CanCollide = false
        scare.Shape = Enum.PartType.Ball
        scare.Size = Vector3.new(11,11,11)
        scare.Position = root.CFrame.LookVector*10+Vector3.new(0,10,0)
        scare.Parent = workspace
        spawn(function()
        while true do
            game:GetService("RunService").Stepped:Wait()
            root.Position = char.HumanoidRootPart.Position
            end
        end)
        spawn(function()
            while true do
                wait()
                root.CFrame = root.CFrame * CFrame.Angles(0,math.rad(1),0)
            end
        end)
        Welder(root,root,scare)

    end
    debounce = false
end)

So my method is putting a block (the root) on the humanoidrootpart (not welded) and weld it to the Sphere that orbits and just rotating the root but the sphere wont move with the Root this is operating on a localscript because its being like a hallucination btw help pls

Answer this question