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

Gun frame Tool| Not Printing?

Asked by 8 years ago

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)
0
mouse is a bool. true or false. you make it into mse? maybe thats the issue ConnorVIII 448 — 8y

1 answer

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
8 years ago

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.

0
still not working :/ pluginfactory 463 — 8y
Ad

Answer this question