I made a when this part is clicked then it fires the remoteevent its a localscript. Now in the frame i did onserverevent also a localscript. The problem is this, im not sure if this is a remote event problem or a gui problem since the gui doesnt show up.
You cannot call OnServerEvent
from a Client perspective. You cannot use a LocalScript on a ClickDetector
either, so the fact is that you have everything essentially flipped. Use a ServerScript within a ClickDetector to Fire the RemoteEvent
upon MouseClick
. Use FireClient
instead, and pass the Player returned by MouseClick as the target Client. Use the LocalScript within the Frame
to pick up the OnClientEvent
signal.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:FindFirstChild("RemoteEvent") --// RemoteEvents should be stored as a child of RepStorage. local ClickDetector = script.Parent ClickDetector.MouseClick:Connect(function(PlayerClicked) RemoteEvent:FireClient(PlayerClicked) end)
Assuming you used a ClickDetector to create a Part Clicked function as you cannot do this otherwise, give it a read-up to ensure you understand it better. Please also take another gander at RemoteEvents as you seem to have misunderstood the Client-Server communication process.
Remember, if this answer helps, don’t forget to accept it!