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

Moving A Part?

Asked by
LostPast 253 Moderation Voter
9 years ago

There are no errors? I expect the code to move the part in the direction of the mouse if you are top down on the part.

local plr = game.Players.LocalPlayer
local Ball = nil
local Screensize = script.Parent:WaitForChild("Shadder").AbsoluteSize

function glideTorwards(currentValue,targetValue,rate)
    if currentValue < targetValue then
        return math.min(targetValue,currentValue + rate)
    elseif currentValue > targetValue then
        return math.max(targetValue,currentValue - rate)
    else
        return targetValue
    end
end

function WFB()
WFBRequire()
while wait() do
local Ba = _G.PlayerBall
    if Ba ~= nil then
        return Ba
    end
end
end

function WFBRequire()
    local MouseY = nil
    local MouseX = nil
    if plr:GetMouse().Y > Screensize.Y/2 then
        MouseY = 2
    elseif plr:GetMouse().Y < Screensize.Y/2 then
        MouseY = -2
    end
    if plr:GetMouse().X > Screensize.X/2 then
        MouseX = 2
    elseif plr:GetMouse().X < Screensize.X/2 then
        MouseX = -2
    end
    repeat wait() until Ball ~= nil
    while wait() and Ball ~= nil do
        Ball.Position = Vector3.new(glideTorwards(Ball.Position,(Ball.Position + Vector3.new(MouseX,0,MouseY)),2))
    end
    WFB()
end

Ball = WFB()
0
Please add more information like what you expect the code to do and what the code is actually doing. We have no idea what "working" means for you, so we can't help you make it work. Unclear 1776 — 9y
0
"if you are top down on the part." What? Restate this please, and what isn't working about the code. Goulstem 8144 — 9y
0
What exactly isn't working? If you don't know, spam your code with print()'s to see what's going on. Perci1 4988 — 9y

Answer this question