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

Can someone help me troubleshoot?

So here is the code


script.Parent.Equipped:connect(function(mouse)
	mouse.KeyDown:connect(function(key)
		debounce=false
		if key=="f" then
			if debounce==false then
				debounce=true
				print("Keydowned")
				local char=script.Parent.Parent
				local plr=game.Players:GetPlayerFromCharacter(char)
				script.Parent.GripUp=Vector3.new(-1, 5, -0)
			a=Instance.new("Part")
			a.Parent=game.Workspace
			b=Instance.new("PointLight")
			b.Parent=a
			b.Range=20
			if plr.TeamColor==BrickColor.new("Bright yellow") then
			b.Color=Color3.new(255/255, 239/255, 5/255)
			elseif plr.TeamColor==BrickColor.new("Dark green") then
				b.Color=Color3.new(25/255, 144/255, 17/255)
			end
			a.CanCollide=false
			a.Transparency=.4
			a.BrickColor=BrickColor.new("Bright yellow")
			a.Shape="Ball"
			a.Size=Vector3.new(.5,.5,.5)
			a.Position=script.Parent.Gun.Position
			a.Velocity=script.Parent.Parent.Head.CFrame.lookVector*math.random(300,500)
			script.Parent.GripUp=Vector3.new(-1, 0.01, -0)
		--add playercheck
		--add movement-Check
		--add color depending on team
		--kthx
			
			debounce2=false
			a.Touched:connect(function(hit)
				if hit.Name==script.Parent.Parent.Parent.Name then
				if debounce2==false then
					debounce2=true
				if hit.ClassName=="Hat" then
				debounce=false
				elseif hit.Parent:FindFirstChild("Humanoid") then
					hit.Parent.Humanoid:TakeDamage(100)
					wait(2)
					debounce=false
				else
					wait(2)
			debounce=false
					end
				end
				end
			
			end)
			
			end
		end
	end)
	
end)


Basically when you press f (Line 4), it shoots a little ball. The problem is, it works in Test mode, but not in game. This is the first time I have dealt with Tools, so there may be something I have not done.

I equipped the tool, and pressed f, it did not print.

There is no output, or anything.

1 answer

well, in a game I don't believe that there is an output. I am just starting tools myself in fact though. :)

2 comments

0

In-game you can use the Developer Console to check the output, by pressing F9.

0

When I say there is no output, I mean there are no errors in the output.

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