User input service not doing anything

Ive tried doing this many different ways but its not doing anything, not even printing or printing errors.

here is my code, what im trying to do is to make a custom proximity prompt, if im doing this inefficiently please reccomend a different way


local player = game.Players.LocalPlayer
local nonvis = player.nonvis
local uis = game:GetService("UserInputService")
local cs = game:GetService("CollectionService")
local ATMguis = cs:GetTagged("ATMgui")

script.Parent.Money.Text = "Your account: $"..nonvis.Bank.Value

nonvis.Bank.Changed:Connect(function()
	script.Parent.Money.Text = "Your account: $"..nonvis.Bank.Value
end)
script.Parent.Deposit.MouseButton1Click:Connect(function()
	script.Parent.DepositEvent:FireServer(script.Parent.TextBox.Text)
end)
script.Parent.Withdraw.MouseButton1Click:Connect(function()
	script.Parent.WithdrawEvent:FireServer(script.Parent.TextBox.Text)
end)
script.Parent.X.MouseButton1Click:Connect(function()
	script.Parent.Visible = false
end)

while wait() do
	if script.Parent.Visible == true then
		if player.Character.Humanoid.MoveDirection.Magnitude > 0 then
			script.Parent.Visible = false
		end
	end
end

uis.InputBegan:Connect(function(input, isui)
	
	if isui then return end
	
	for i, v in pairs(ATMguis) do
		if v.Visible == true and input.KeyCode == Enum.KeyCode.E then
			script.Parent.Visible = true
		end
	end
	
end)

this gui should be showing up when the player presses E

2 Likes

You don’t have to implement your own system for a prompt, Roblox’s built-in proximity prompt has a property of Style which you can set to custom, that way you can customize it to your liking.

ProximityPromptService has a PromptShown event, you can define your custom GUI using this built-in event, you can define your GUI animations using PromptTriggered and PromptTriggerEnded. Read more about them in the documentation.

Here is a code example:

ProximityPromptService.PromptShown:Connect(function(prompt)
    -- We don't want to touch prompts that are not set to custom
	if prompt.Style == Enum.ProximityPromptStyle.Default then
		return
	end

    local customPromptUI = ReplicatedStorage.CustomPromptUI

    customPromptUI.ObjectText.Text = prompt.ObjectText
	customPromptUI.ActionText.Text = prompt.ActionText
	customPromptUI.InputText.Text = `[{prompt.KeyboardKeyCode.Name}]`

    -- ...
end)

If you need an idea of how you are supposed to do this, you can take a look at the default proximity prompt code here.

2 Likes

So am I moving the billboard GUI into the proximity prompts parent?

1 Like

Nevermind it works. Thank you for the help!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.