UI not appearing

My script is really weird and I don’t understand why I did half of it, so bear with me.

What I am trying to do is create a system where a player goes up to a bank teller and then the teller gets a UI that pops up where they can deposit/withdraw money from the player’s account.

My issue is that UI never opens whenever both players are there and have activated the proximity prompt.

If you have any ideas on how to clean this up as well could you say so.

LocalScript called "Handler" inside the UI
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerInterface = script.Parent.TellerInterface

event.OnClientEvent:Connect(function(command, player)
	if command == "OpenTellerUi" then
		tellerInterface.Enabled = true
	end
end)
Server Script that detects the Teller
local prompt = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerThere = script.Parent.tellerThere
local tellerVal = script.Teller

prompt.Triggered:Connect(function(teller)
	if tellerThere.Value == false then
		teller.Character.Humanoid.WalkSpeed = 0
		teller.Character.Humanoid.JumpPower = 0

		tellerThere.Value = true
		tellerVal.Value = teller.Name
		prompt.Enabled = false
	end
end)
Server Script that detects the Player
local prompt = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerThere = script.Parent.Parent.TellerDetection.tellerThere
local tellerVal = script.Parent.Parent.TellerDetection.Script.Teller.Value


if tellerThere.Value == true then
	prompt.Triggered:Connect(function(player)
		local teller = game.Players:FindFirstChild(tellerVal.Value)
		player.Character.Humanoid.WalkSpeed = 0
		player.Character.Humanoid.JumpPower = 0
		
		event:FireCient(teller, "OpenTellerUi", player)
	end)
end

There’s a misspelling in your server script which detects the player. Change FireCient to FireClient

1 Like

Weird that I didn’t get any errors, I will fix it and see if that is the issue thanks!

Also, make sure to put your if tellerThere.Value == true then statement in the connection to prompt.Triggered - otherwise, it’ll never connect as at first tellerThere.Value isn’t true.

Fixed code:

local prompt = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerThere = script.Parent.Parent.TellerDetection.tellerThere
local tellerVal = script.Parent.Parent.TellerDetection.Script.Teller.Value


prompt.Triggered:Connect(function(player)
    if tellerThere.Value == true then
		local teller = game.Players:FindFirstChild(tellerVal.Value)
		player.Character.Humanoid.WalkSpeed = 0
		player.Character.Humanoid.JumpPower = 0
		
		event:FireClient(teller, "OpenTellerUi", player)
	end
end)
1 Like

Yeah I got an error on that script specifically line 4

I will test it again but I don’t really see the problem with line 4.

It looks like the value doesn’t exist. Try putting tellerVal inside of the if statement, like this:

local prompt = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerThere = script.Parent.Parent.TellerDetection.tellerThere



prompt.Triggered:Connect(function(player)
	if tellerThere.Value == true then
		local tellerVal = script.Parent.Parent.TellerDetection.Teller.Teller.Value
		local teller = game.Players:FindFirstChild(tellerVal.Value)
		if teller then
			player.Character.Humanoid.WalkSpeed = 0
			player.Character.Humanoid.JumpPower = 0
			event:FireClient(teller, "OpenTellerUi", player)
		end
	end
end)
1 Like


There is the error and script.

image
This is the workspace

Oh - Teller is the name of the script. Let me change my code to match that.

1 Like

I’ve changed my code to match your image of the explorer. Happy coding!

1 Like

Still doesn’t work, there are no errors anymore though

Maybe it’s because it only fires the event for the teller and not the player too?

1 Like

It should only appear for the teller.

Try this and see if it works:

local prompt = script.Parent.ProximityPrompt
local event = game:GetService("ReplicatedStorage").Banking.DepWith.Communicate
local tellerThere = script.Parent.Parent.TellerDetection.tellerThere



prompt.Triggered:Connect(function(player)
	if tellerThere.Value == true then
		local tellerVal = script.Parent.Parent.TellerDetection.Teller.Teller
		local teller = game.Players:FindFirstChild(tellerVal.Value)
		if teller then
			player.Character.Humanoid.WalkSpeed = 0
			player.Character.Humanoid.JumpPower = 0
			event:FireClient(teller, "OpenTellerUi", player)
		end
	end
end)
2 Likes

Consider making the frames visible to false then change that to visible because the local script can only run if the ui is enabled. Please let me know if I am wrong though.

Worked thanks! (What did you change?)

I only just noticed that you were trying to get the value of a string, I don’t know how I only just now noticed that lol

1 Like

image
Thanks, but the local script is outside of the interface!