I have a module script, and everything works when I run it, except the UserInput, any suggestions?
function GunStats.check3(player) local character = player.Character or player.CharacterAdded:Wait() local humRoot = character:WaitForChild("HumanoidRootPart") for i, v in pairs(game.Workspace:GetDescendants()) do if v:IsA("Part") then if v.Name == ("BillboardPart") then for i, v in pairs(v:GetChildren()) do if v.Name == ("BillboardGui") then while wait() do if (humRoot.Position - part.Position).Magnitude < 5 then check = true v.Enabled = true uis.InputBegan:Connect(function(input, gameprocessed) if input.Keycode == Enum.KeyCode.E then print("hi") end end)
Script in Workspace connecting to the ModuleScript
local players = game:GetService("Players") local serverStorage = game.ServerStorage local gunStats = require(serverStorage:WaitForChild("ModuleScript")) game.Players.PlayerAdded:Connect(function(players) gunStats.check3(players) end)
On line 13 i was taught that it should be like this
uis.InputBegan:Connect(function(input, gameProcessedEvent)
It probably makes no difference and i'm sorry if it doesn't work for you.