Answered by
6 years ago Edited 6 years ago
first of all, you didnt set the Parent
of the Beam
so it wont appear, and you dont need to set the Position
of the beam. also the Equipped
event wont fire if the player clicks the mouse, it fires when the tool is equipped by the player the event you want is the Button1Down
event of the players mouse such as this example.
1 | script.Parent.Equipped:Connect( function (mouse) |
2 | mouse.Button 1 Down:Connect( function () |
3 | print ( "i have been clicked" ) |
also your defining the player's mouse 2 times in your script as your doing a variable of the mouse and the parameter of the Equipped
event which is the players mouse.
01 | local part = game.Workspace.beamtest |
02 | local Players = game:GetService( "Players" ).LocalPlayer |
03 | local Tool = script.Parent |
04 | local gun = script.Parent.Handle |
06 | Tool.Equipped:Connect( function (mouse) |
07 | mouse.Button 1 Down:Connect( function () |
08 | local att 0 = Instance.new( 'Attachment' ) |
09 | local att 1 = Instance.new( 'Attachment' ) |
10 | local beam = Instance.new( "Beam" ) |
12 | beam.Color = Color 3. fromRGB( 144 , 144 , 144 ) |
13 | beam.Attachment 0 = att 0 |
14 | beam.Attachment 1 = att 1 |
21 | beam.Parent = workspace |
and the parent arguement of Instance.new()
is decaperated, instead set the parent last, and i would also suggest using the players Backpack
instead of StarterPack
. theres alot more mistakes too