"Attempt to index nil with PlayerGui"

How can I index the PlayerGui then through the prox. prompt?

change into

workspace.feedbacknPC.Torso.ProximityPrompt.Triggered:Connect(function(player)
	local ui = player.PlayerGui:WaitForChild("Feedback", 15)
	ui.MainFrame:TweenPosition(UDim2.new(0.344, 0, 0.673, 0), "Out", "Quart", .5, true) --0.673
end)


the reason why is mentioned already

2 Likes

You can obtain the Player through the functions parameters. As I mentioned before, or you can look at what @hestolemyrice posted above.

I’m pretty sure you can’t access playergui in a server script, since that’s what many have told me. Try using remote events.

you can, you only can’t access player scripts

Interesting. Still, wouldn’t it make sense for the client to handle playergui instead of the server? The server should be where you do critical tasks, instead of using up server resources.

Edit: Here’s a post about it, actually.

Thanks, But now it only completes the tween once.
.

Take a close look at the position

You might need to change everything into a local script

but you cant find if a proximityprompt is triggered locally, it has to be server sided, right?

The reason why it only does once is most likely because the script only runs 1 time

workspace.feedbacknPC.Torso.ProximityPrompt.Triggered:Connect(function(player)
print("triggered")
	local ui = player.PlayerGui:WaitForChild("Feedback", 15)
	ui.MainFrame:TweenPosition(UDim2.new(0.344, 0, 0.673, 0), "Out", "Quart", .5, true) --0.673
end)

I need to see if it prints

You can detect if a proximityprompt fires on server or client or both

image

lemme see the video too like i need to see the output and you triggering it at the same time

Could you show us where you are closing/removing the Gui. After you’ve clicked exit or… something.

Is the closing of the gui from local script?

Pretty sure he is. Since there’s no mention of it in the script he provided, besides tweening it out.

Then that’s the problem though, it’s either he change local script into server script or he change server script into local script

Yeah, the whole script is a mess honestly. But if he doesn’t want to change it the best we can do is help fix it.