Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

tool.equiped not working cuz equip bool value not changing to true?

hi, I am making a football, but I have a problem.

the issue is that i keep getting "i am awesome and cool and handsome and the best" over and over again, although i am supposed to stop getting that when the tool is equipped. this is because equip boolean is not changing to true!

i can tell by that i don't get "animation folder" (line 24) in output.

the local script is in tool in starterpack, but tool's parent switch to the player's character when equipped.

[issue is on line 14]

[there is no error]

script:

---shortcuts
local football = script.Parent
local anim = football:WaitForChild("football anim")
local experience = game.Workspace
local equip = football.equip.Value
local force = football.VectorForce
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()

---know when footbal is selected
function eqeqeqeeqqioipip(mouse) --doctor i am fine ahahhahfbahfhabfahbfahfbahfb
	local equip = true
	print(equip.Value)
end

---find animation folder
repeat
	wait(1)
	print("i am awsome and cool and handsome and the best")
until equip == true
if football.Parent.anim_folder == not nil then
	local anim_folder = football.Parent.anim_folder
	print(anim_folder.Name)
elseif football.Parent.animation_folder == not nil then
	local anim_folder = football.Parent.animation_folder
	print(anim_folder.Name)
elseif football.Parent.AnimationFolder == not nil then
	local anim_folder = football.Parent.AnimationFolder
	print(anim_folder.Name)
elseif football.Parent.animationFolder == not nil then
	local anim_folder = football.Parent.animationFolder
	print(anim_folder.Name)
elseif football.Parent.animationfolder == not nil then
	local anim_folder = football.Parent.animationfolder
	print(anim_folder.Name)
	
	---if there is none, make a new one
else
	local anim_folder = Instance.new("Folder", football.Parent)
	anim_folder.name = "animation folder"
	anim_folder:SetAttribute("info", "this folder was made by a script in some tools made by jerem_qpmfpi")
	print(anim_folder.name)
end

---move animation to character
anim.parent = anim_folder
local anim = anim_folder:WaitForChild("football anim")

---football_used funtion
function football_used()

	---play animation
	anim:Play()

	---wait a bit
	wait(0.7)

	---detach football from player
	football.Parent = experience --so roblox doesn't shoot me

	---throw football
	force.Force = Vector3.new(100, 0, 0)
	wait(1)
	
	---delete it all
	anim:Destroy()
	football:Destroy()
end

---triggers
football.Activated:Connect(football_used)
football.Equipped:Connect(eqeqeqeeqqioipip)

1 answer

First I see that on line 5 you create an equip variable so if you're trying to reference that then on line 13 don't do local equip = true since local creates a new variable.

If you are in fact talking about the line 5 equip variable then also don't do print(equip.Value) as in the end it would be equal to print(football.equip.Value.Value).

If .Value on line 5 is an object then change line 13 to equip.Value = true

Summary: there are 2 main answers for you to test so I'll put them here in the order you should test them from most likely to help to least likely. This can replace line 1 to 15

---shortcuts
local football = script.Parent
local anim = football:WaitForChild("football anim")
local experience = game.Workspace
local equip = football.equip.Value
local force = football.VectorForce
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()

---know when footbal is selected
function eqeqeqeeqqioipip(mouse) --doctor i am fine ahahhahfbahfhabfahbfahfbahfb
    equip = true
    print(equip)
end
---shortcuts
local football = script.Parent
local anim = football:WaitForChild("football anim")
local experience = game.Workspace
local equip = football.equip.Value
local force = football.VectorForce
local players = game:GetService("Players")
local player = players.LocalPlayer
local mouse = player:GetMouse()

---know when footbal is selected
function eqeqeqeeqqioipip(mouse) --doctor i am fine ahahhahfbahfhabfahbfahfbahfb
    equip.Value = true
    print(equip.Value)
end

1 comment

0

bruh, i realized the error was actually on line 21 lol

This discussion is preserved as it was. New answers, comments, and votes are closed.