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

Why do I get this error message, "FireServer can only be called from the client"?

Asked by 8 years ago
bin = script.Parent

function onTouched(part)



    workspace.OBJCONTROL.Obj1:FireServer()
    workspace.TALKCONTROL.Talk1:FireServer()
end


connection = bin.Touched:connect(onTouched)


I have this script in a part in the workspace, and it is a LocalScript. It gives the the error message, FireServer can only be called from the client. The Remote Event is in a folder in the workspace too, and that connects to a GUI that allows it to change text,



game.workspace.TALKCONTROL.Talk1.OnServerEvent:connect(function(change) script.Parent.TextLabel.Text='The servers are running fine. Weird..' wait(7) script.Parent.TextLabel.Text='' end) game.workspace.TALKCONTROL.Talk2.OnServerEvent:connect(function(change) script.Parent.TextLabel.Text='Maybe I should look for co-workers.' wait(4) script.Parent.TextLabel.Text='' end) game.workspace.TALKCONTROL.NPC.NPCT1.OnServerEvent:connect(function(change) script.Parent.TextLabel.Font="SourceSans" script.Parent.TextLabel.Text="What's going on?!" wait (3) script.Parent.TextLabel.Text='' wait (3) script.Parent.TextLabel.Text="Is anyone else here?" wait (3) script.Parent.TextLabel.Text='' wait (3) script.Parent.TextLabel.Text="I'll look for others, you should look for an exit." wait (3) script.Parent.TextLabel.Text='' wait (3) script.Parent.TextLabel.Text="I will. Bye." game.Workspace.OBJCONTROL.Obj3_5:FireServer() wait (3) script.Parent.TextLabel.Text='' end) game.workspace.TALKCONTROL.Talk3.OnServerEvent:connect(function(change) script.Parent.TextLabel.Font="SourceSansItalic" script.Parent.TextLabel.Text='None of the lab guys are here today. Weird.. Maybe I should check the Announcement board.' wait (4) script.Parent.TextLabel.Text='' end) game.workspace.TALKCONTROL.Talk4.OnServerEvent:connect(function(change) script.Parent.TextLabel.Text="A bombing?? I gotta get outta here!" wait (4) script.Parent.TextLabel.Text='' end)

Please help. Also, if I am not clear enough, do let me know.

0
you can't have a local script in workspace Perci1 4988 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

The LocalScript should just be a regular script. Simple as that.

0
If this doesn't work, please let me know. I tested it in studio, not online mode, so it might not work there. mustardfoot 90 — 8y
0
Yeah it won't work online fearlesswindow 0 — 8y
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

You can simply move the local script from the part into the the StarterPack. Then re-edit the code like:

bin = game.Workspace.(name of the part) --You should rename the part so you can find it

bin.Touched:connect(function()  
workspace.OBJCONTROL.Obj1:FireServer()
workspace.TALKCONTROL.Talk1:FireServer()
end)
0
It still gives the same error.... fearlesswindow 0 — 8y
0
I don't know why then, it works for me. ThatEvaThing 0 — 8y

Answer this question