I copied a smooth shiftlock script from the internet which uses bindable events.
Even though the script works in studio, the bindable event doesn't fire when I publish the game.
Local script (tool):
local ShiftLockEvent = rep.b_ToggleShiftLock
local function onEquipped()
if not tool then return end
ShiftLockEvent:Fire(true, aimDownsightsOffset, v_crosshair)
end
Local module script: (smooth Shiftlock):
local ToggleEvent = rep.b_ToggleShiftLock
function SmoothShiftLock:CharacterAdded()
--// Bindables
self.connectionsMaid:GiveTask(ToggleEvent.Event:Connect(function(toggle, offset, mouseIcon)
if (self.Humanoid and self.Humanoid.Health ~= 0) then
self:ToggleShiftLock(toggle, offset, mouseIcon);
end;
end));
return self;
end;
I don't have much experience with oop so any help would be appreciated.
I also tested the same bindable event at the very beginning to a test function (not connected to the class) and it was working fine so I guess the problem is in the 2nd script.
** You are now Level 3! **