UI does not want to be visible

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Hello! This is my first post, apologies if I break any rules… So basically, I have written a script that tries to make the UI visible through a proximity prompt. It fires an event from replicated storage that makes the UI visible in the server script with the proximity prompt as the parent.

  2. What is the issue? Include screenshots / videos if possible!
    The UI refuses to become visible despite having no errors in the code. I believe everything is declared as a local variable correctly. (if not apologies please help fix thanks!)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked through multiple developer forums and searched with many keywords. However I was unable to find a useful forum. I have also used the Roblox Creator Hub assistance pages but to no avail.

Here is my code

-- In server script under proximity prompt
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
local sound = workspace.HelpingKo.ProximityPrompt.Script.CallBell
local speak = game.StarterGui.DarkPlayer.SpeakingKo
script.Parent.Triggered:Connect(function(plr)
    wait(.2)
    sound:Play()
    wait(0.2)
    game.ReplicatedStorage.Events.OpenShop:FireClient(plr, "SpeakingKo")
        speak.Visible = true
    wait(3)

end)

if speak.Visible == true then
    print("Yes")
end
-- Yes does not print, indicating the UI is not visible
2 Likes

this runs once the script starts if you want it to run when prompt triggered put it inside

after wait(3) I suppose.

Thanks for your quick reply!
I have moved the code to where you indicated and console prints “yes” even though the UI isn’t visible…
Screenshot 2024-07-27 at 3.33.23 PM
The UI is in the middle and is not off the screen…

When the player joins the game, items under StartPlayer are cloned to that player and therefore have new references, so:

local speak = game.StarterGui.DarkPlayer.SpeakingKo
-- would become
local speak =  game.<player name>.PlayerGui.DarkPlayer.SpeakingKo

However, you need to reference the sending player, so define the speak UI within the remote event:

script.Parent.Triggered:Connect(function(plr)
    local speak =  plr.PlayerGui.DarkPlayer.SpeakingKo   
     wait(.2)
    sound:Play()
    wait(0.2)
    game.ReplicatedStorage.Events.OpenShop:FireClient(plr, "SpeakingKo")
        speak.Visible = true
    wait(3)

end)
1 Like

Thanks for helping! It worked!

This actually helped a lot and reminded me that I forgot to define player :sob:

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