UI not showing up when part is touched

basically, i have a regular script inside a part that, when touched, should make a frame from the UI turn visible. however, only the sound i scripted it to play works, and the UI itself doesnt actually show up. im not a great scripter so it could be an easy fix that im not seeing

Screenshot_1

the above is the script im using

Make sure all assets in Whisper have their Visible Boolean set to false. And make sure it is spelled correctly and is actually a Frame.

Also, you will need to use PlayerGUI to make it possible to work in a multiplayer setting.

I’ve tested the code, and it works just fine. The reason why the GUI is not appearing is that you’re modifying the one that is inside StarterGui, not the one inside PlayerGui.

Check if this version works for you.

local Players = game:GetService("Players")

local whisp = game.Workspace.Music.whisper1
whisp.Volume = 4
local prt = game.Workspace.whisperpart

function whis(hit)
	local Character = hit.Parent
	local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
	
	if Humanoid and Humanoid.Health > 0 then
		local Player = Players:GetPlayerFromCharacter(Character)
		local PlayerGui = Player.PlayerGui

		local dbuif = PlayerGui.whisper.water

		whisp:Play()
		prt:Destroy()
		dbuif.Visible = true
		wait(2)
		dbuif.Visible = false
	end
end

script.Parent.Touched:Connect(whis)
2 Likes

hey, thanks for the reply,

so i replaced what i had and this time, neither the sound nor the UI appeared/played.

to add, nothing shows in the output, so im a little lost at what the issue is, if this script is working for you. the game itself is meant to be a single player, 1 person server game, and the script isnt in the game as a localscript, but a regular script.

Answering your last post, you’re welcome.

When I tested the code, I put it inside a Part of the workspace to use it with the Touched event. Where is your script located?

I got it to work, i think it had to do with collisions. thanks again!

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