code not working, 11 fps Posted: 20 Aug 2020 08:26 AM
local RunServ = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local weaponEvent = game.ReplicatedStorage.equipWeapon
local playerWeapons = game.ServerScriptStorage
RunServ.RenderStepped:Connect(function() -- check every frame
if playerWeapons[Player] then -- check if player in table
-- check every frame the player's weapon
if playerWeapons[Player] == 1 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 2 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 3 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 4 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 5 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 6 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 7 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 8 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 9 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
elseif playerWeapons[Player] == 10 then
weaponEvent:FireServer(playerWeapons[Player])
print(weaponEvent[Player])
end
end
end)