Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Module Script not running UserInput?

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)

2 answers

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.

2 comments

0

The argument names can just be whatever you want

0

oh

This discussion is preserved as it was. New answers, comments, and votes are closed.