This may seem really repetitive, but I'm trying my best to have my answer fully, lol. I have a bunch of screenshots to show you, as well as me trying to attempt to use the TextButton.

So what this TextButton is suppose to do is it's suppose to move the Handle around my Body, as if I were dribbling a basketball...

Here is the code:

local plr = script.Parent.Parent.Parent.Parent
local tool =  script.Parent.Parent.Parent
local gui = script.Parent.Parent
local button = script.Parent
local Debounce = true
local Active = false

local CoolDown = 0.01
local function Start()
tool.rMovement.Disabled=true
    tool.lMovement.Disabled=true
    tool.HandValue.Value = 1
        tool.GripPos = Vector3.new(0.5, -0.5, -0.3)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, -1, 0)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, -1.5, 0.5)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, -1.5, 1)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, -1.5, 1.5)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, -1, 2)
        wait(0.01)
        tool.GripPos = Vector3.new(1, -0.5, 2.5)
        wait(0.01)
        tool.GripPos = Vector3.new(1.5, 0, 3)
        wait(0.01)
        tool.GripPos = Vector3.new(2, 0.5, 3)
        wait(0.01)
        tool.GripPos = Vector3.new(2.5, 1, 3)
        wait(0.01)
        tool.GripPos = Vector3.new(3, 1.5, 3)
        wait(0.01)
        tool.GripPos = Vector3.new(2.5, 2, 2.5)
        wait(0.01)
        tool.GripPos = Vector3.new(2, 2.5, 2)
        wait(0.01)
        tool.GripPos = Vector3.new(1.5, 3, 1.5)
        wait(0.01)
        tool.GripPos = Vector3.new(1, 3.5, 1)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, 3, 0.5)
        wait(0.01)
        tool.GripPos = Vector3.new(0.5, 2.5, 0)
        wait()
    tool.lMovement.Disabled=false
end

tool.Unequipped:connect(function() -- this somehow isn't working either, but everything seems fine to me when I define "tool".
	tool.rMovement.Disabled=true
	tool.lMovement.Disabled=true
	local plr=game.Players:findFirstChild(tool.Parent.Name)
	if plr and tool.Parent:findFirstChild("Humanoid") then
		local c=gui:Clone()
		c:Destroy()
	end
	if tool.HandValue.Value==1 then
		tool.lMovement.Disabled=false
	else tool.rMovement.Disabled=false
	end	
end)

button.MouseButton1Down:connect(function()
    if Debounce then 
    Debounce = false
        Start()
    wait(CoolDown)
    Debounce = true
  end
end)


function onKeyPress(actionName, userInputState, inputObject)
    if userInputState == Enum.UserInputState.Begin then
        if Active and Debounce then
        Debounce = false
            Start()
        wait(CoolDown)
        Debounce = true
    end
    end
end

game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.G)

Here is the error I get: screenshot

Here are some other screenshots where the Tool is Located, as well as the Gui.

1st Screenshot

2nd Screenshot

This is a GIF to see that the Function Start() doesn't work.

GIF

Here's what the Function is SUPPOSED to do:

GIF

GIF #2

Hopefully this is enough information, if it isn't I will be glad to make another question, or codeshare with you guys or something.

Thanks, LukeGabrieI aka EnergyBrickz

7 comments

0

Why is the function local?

0

Also I'm having issues with functions relating to tools @ line 50

0

this is in a local script. and whenever i unequip the tool, the screen gui should disappear.

0

I had my friend make this, but it still doesn't work for some reason even if the function is local/not local.

0

The error is saying that your "tool" variable is actually PlayerGui, not the Tool. I would recommend that you don't put the GUI inside the tool. Put the Script inside the tool, put the gui in PlayerGui. Then just access it via the local player: player.PlayerGui.GUI

0

here's a suggestion, instead of all that wait(0.1) mumbo jumbo, use Tweening instead. http://wiki.roblox.com/index.php?title=API:Class/TweenService

0

I already got this figured out lol