Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Remote Event problem or gui?

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.

1 answer

✓ Accepted answer

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!

2 comments

1

you are smartest man on earth

0

Thanks ;)!

This discussion is preserved as it was. New answers, comments, and votes are closed.