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

Gun frame Tool| Not Printing?

Idea Print every time the player clicks this tool.
Problem Nothing Is happening (Local Script)
Code:

------Variables------
plr = game.Players.LocalPlayer
char = plr.Character
tool = script.Parent
------Variables 2------
reloading = false
mouse = nil
ammo = 5
------Functions------
function Reload()
	print"Reload"
end
-----------------
function Shoot()
	print"Shoot"
	ammo = ammo -1
end
-------------------
function Splatter()
	print"Splatter"
end
-------------------
tool.Activated:connect(function(mse)
	mouse = mse
	Shoot()
end)

1 comment

0

mouse is a bool. true or false. you make it into mse? maybe thats the issue

1 answer

✓ Accepted answer

First of all, when you start a localscript with defining LocalPlayer and Character, you need to make the script wait until both of these exist. Sometimes local scripts execute before these both exist. To fix this, use the following code:

repeat wait() until game.Players.LocalPlayer; -- Wait until LocalPlayer exists
plr = game.Players.LocalPlayer
char = plr:WaitForChild("Character") -- Wait until Character exists

Also, it looks like you are trying to get the mouse. To do so, you can use GetMouse(), which is a function of Player. GetMouse() returns PlayerMouse. Click the link to view the properties and events of PlayerMouse.

1 comment

0

still not working :/

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