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

After unequipping tool, script.Parent.Activated:Connect executes twice?

Asked by 4 years ago

WARNING: VERY CRAPPY CODE!

Whenever I unequip my gun (not dropping) and re-equip, it works normally except for

script.Parent.Activated:Connect(function() @ (Line 81)

The line executes multiple times for a reason I cant explain. Here is my local script:

001-- Preference Locals
002local MaxAmmo = 1
003local ShootDelay = 0.2
004local MaxCamShake = 1
005local ReloadTime = 7.5
006-- Main Locals
007local Unequipped = false
008local Ammo = MaxAmmo
009local Reloading = false
010local MuzzleOn = false
011local player = game.Players.LocalPlayer
012local char = player.Character or player.CharacterAdded:wait()
013local humanoid = char:WaitForChild("Humanoid")
014local Mouse = game.Players.LocalPlayer:GetMouse()
015local camera = workspace.CurrentCamera
View all 114 lines...
0
Please accept the answer that works User#30567 0 — 4y
0
sorry needed to check if it works rookiecookie153 53 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Instead of having :Activated in the equipped event, put it as its own event, outside of the equipped event!

0
oh thx rookiecookie153 53 — 4y
0
accept my answerrr DragonSpawner12 61 — 4y
0
kk rookiecookie153 53 — 4y
Ad

Answer this question