Log in to vote

ServerScriptService is not a valid member of DataModel?

Asked by 9 months ago

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

    local player = game.Players.LocalPlayer
    local ThePlayerName = script.Parent.Parent:WaitForChild("PlayerNameHere").Text
    print(ThePlayerName.."'s the player name that got sent!")

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!

1 answer

Log in to vote
Answered by
Denny9876 1154 Moderation Voter
9 months ago

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!

I did a ton of changings and followed ur tips and made it all on the workspace using remote events and everything is working! I've been trying so long! Hallelujah i'm free. Thank you my friend! wilsonsilva007 266 — 9mo

Answer this question