Why is the script not making the UI pop up

Hello, i want the script to enable a UI when a proximityprompt has been triggered, ive tried it with remoteevents but it wont work, im new to remotevents so dont be to suprised here is my script that should fire the remotevent:

local proxpromt = script.Parent
local repstorage = game:GetService("ReplicatedStorage")
local paperevent = repstorage.PaperEvent


proxpromt.Triggered:Connect(function()
	paperevent:FireClient()
end)

here is my event (its the paperevent):
image

here is my local script thats inside startercharacterscripts:

local PaperEvent = game.ReplicatedStorage.PaperEvent
local player = game.Players.LocalPlayer


PaperEvent.OnClientEvent:Connect(function()
	if player.PlayerGui.ScreenGui.Enabled == false then
		player.PlayerGui.ScreenGui.Enabled = true
	else
		return nil
	end
	
end)

here is the error i get from the output that says something is wrong with the normal script, not the local one.
image

1 Like

Sometimes RemoteEvents don’t work. I tried using a remote event once and about a quarter of the time it would just run one line of code and stop.
Try:

local proxpromt = script.Parent
local repstorage = game:GetService("ReplicatedStorage")
local paperevent = repstorage.PaperEvent


proxpromt.Triggered:Connect(function()
	player.PlayerGui.ScreenGui.Enabled = not player.PlayerGui.ScreenGui.Enabled
end)

Hopefully this fixes your issue.
Edit: On the fire client argument, you need to reference the player inside the brackets.

This is because you don’t got the player argument inserted for you. Lucky for you ProximityPrompts give the player as a variable

proxpromt.Triggered:Connect(function(player)
	paperevent:FireClient(player)
end)

i got a question, the code you sent worked, now im working on a button that would close it.
it says player argument must be a player object.

local button = script.Parent
local repstorage = game:GetService("ReplicatedStorage")
local paperendevent = repstorage:WaitForChild("PaperEndEvent")

button.MouseButton1Click:Connect(function(player)
	paperendevent:FireClient(player)
	
end)

MouseButton1Click, doesn’t return the player. You would have to get it somehow else

thats the part i always get stuck at lol, never seem to be able to find the player.

should i make a seperate post about it?

Not needed, but if you are desperate I guess go ahead. But like I said MouseButton1Click doesn’t return the player fyi

1 Like

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