What am I trying to do? I’m trying to make a gui text
Change when Proximity Prompt is triggered
What is the issue? The gui text is not changing
Thing’s i’ve tried I tried searching it up, and I tried making the script a local script
Here is my script
local int = game.Workspace.Int
local pp = script.Parent
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Parent.Animation)
pp.Triggered:Connect(function()
if game.StarterGui.ScreenGui.Me.Text == "Label" then
game.StarterGui.ScreenGui.Me.Text = "Me:Hey Detective have you found anything yet?"
end
wait(5)
if game.StarterGui.ScreenGui.Me.Text == "Me:Hey Detective have you found anything yet?" then
game.StarterGui.ScreenGui.Me.Text = "Detective: No I haven't found anything yet!"
anim:Play()
end
end)
You’re changing from StarterGui, the changes wont replicate until a respawn happens, you need to reference the player’s PlayerGui, which thankfully is possible since Triggered returns the Player who triggered the event, try this out
local int = game.Workspace.Int
local pp = script.Parent
local anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Parent.Animation)
pp.Triggered:Connect(function(plr)
local plrGui = plr.PlayerGui
if plrGui.ScreenGui.Me.Text == "Label" then
plrGui.ScreenGui.Me.Text = "Me:Hey Detective have you found anything yet?"
end
wait(5)
if plrGui.ScreenGui.Me.Text == "Me:Hey Detective have you found anything yet?" then
plrGui.ScreenGui.Me.Text = "Detective: No I haven't found anything yet!"
anim:Play()
end
end)