Guys this problem is driving me crazy!
I always get this error when I'm trying to get the ServerScriptService
from a LocalScript
.
RemoveEvent is in ServerScriptService
Here's the code: It's a LocalScript
script.Parent.MouseButton1Click:connect(function() local player = game.Players.LocalPlayer local ThePlayerName = script.Parent.Parent:WaitForChild("PlayerNameHere").Text game.ServerScriptService:WaitForChild("UnBanPlayer"):FireServer(ThePlayerName) print(ThePlayerName.."'s the player name that got sent!") end)
When I use a LocalScript
it gives me that error. But when I use a ServerScript
I get the following error:
FireServer can only be called from Client
.
What do I do?
I'm getting confused!
I think ServerScriptService can only be accessed by server scripts, which is why you’re getting errors from a localscript.
When you switch to a server script though, you’ll still get an error because :FireServer() in line 4 can only be used by local scripts. Server scripts do :FireClient() or :FireAllClients() and local scripts do :FireServer().
Oh, and when you play the game in a server, your script won’t work anyways because I think only local scripts can be used for GUI buttons. (If it’s in a SurfaceGui though, I don’t know. I haven’t used SurfaceGuis often.)
Hoped this helped!