Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

onServerEvent can only be fired on servers error??

Asked by 8 years ago
Edited 8 years ago

I made an inventory gui,it works fine on Studio but on my game it doesn't work. It keeps saying onServerEvent can only be fired on servers for example,im using MouseEnter and MouseLeave,that works on my place. But mousebutton1click does not work on my place when i want to use it,only on my studio. script example.

script.Parent.MouseButton1Click:connect(function()
    frame:TweenPosition(UDim2.new(0.5,-250,0.5,-200),"Out" ,"Quint" ,0.5)
    print("Test")
end

is there any solution to this? as i said,i did not use a single word saying "onServerEvent" on my script. please help me,i asked this before but didn't help.

0
You obviously have some buggy code in your game that is using RemoteEvents. You need to find it and ERADICATE it :P TheDeadlyPanther 2460 — 8y
0
I only have a inventory GUI script.I havent used a single word saying remote event on it.. kristibezatlliu1111 33 — 8y
0
Do CTRL+Shift+F then search for 'RemoteEvent' or 'OnServerEvent'. TheDeadlyPanther 2460 — 8y
0
nevermind,it was a buggy code just as you said,thank you. kristibezatlliu1111 33 — 8y

1 answer

Log in to vote
0
Answered by
StoIid 364 Moderation Voter
8 years ago
Edited 8 years ago

The reason you are getting the "OnServerEvent can only be fired on servers" is because you are probably using .OnServerEvent in a LocalScript and this is one of the no no's of RemoteEvents.

If you want to use OnServerEvent, it must be used in a ServerScript.

Think of it as this, ServerScripts(the regular blank blue ones) can only see and run on the server, and LocalScripts can only see what's on the client, and only run on the client (The "client" is your computer and it is the script with the person looking thing on it). Also in tandem with both, ServerScripts can use ServerScript properties and LocalScripts are the same, so this means OnServerEvent (A ServerScript property) cannot be used on a LocalScript, thus giving you your error.

For more info and help i suggest you do some learning on RemoteEvents etc.

Helpful Links!


ScriptGuider's Youtube Video On Remote Events (SUPER HELPFUL)

Very good explanation on LocalScript vs Server script usage : By Link150

RemoteEvents and Functions

ServerScripts

LocalScripts

Ad

Answer this question