im sorry if im stupid but im not that experienced with GetService or Remote Events
What solutions have you tried so far? i tried looking on youtube and i found some info and methods such as fireServer and stuff, google nothing, the devforum i found a post saying to use a RemoteEvent and then executing it from the server
i tried using what i saw on youtube but didnt work
You almost had it In your LocalScript you fired the RemoteEvent, but from what I saw it doesn’t seem like you actually connected the Event to detect the calls from
Honestly though, RemoteEvents are simple once you get to know them well as they’re capable of handling 1-way transportation
Point A is where we currently are now, and nothing can’t happen unless we call our FireServer() function as you stated before
Once we start going, we then travel onto Point B where we’ll receive those said “calls” to transport the goods over, but we need to have something called OnServerEvent for Point B in specific so we can confirm when those Events fire and to receive back
Although, you put your RemoteEvent within ServerScriptService & unfortunately, that’s only Server-Sided so the client isn’t able to see that RemoteEvent
If you put it somewhere that’s replicated easily, like ReplicatedStorage then that can work just fine
Now we’re still in Point A, but now we have to arrive to Point B in order to receive it, so we can do something like this here:
local RS = game:GetService("ReplicatedStorage")
local BadgeService = game:GetService("BadgeService")
local PacifistBadge = 4254040307
local Event = RS:WaitForChild("PacifistEnding") -- We want to use this
Event.OnServerEvent:Connect(function(Player) -- By default, OnServerEvent passes the Player as the first parameter
BadgeService:AwardBadge(Player.UserId, PacifistBadge)
end)
You’ll also have to change your LocalScript as well so that it can detect the RemoteEvent inside ReplicatedStorage but that should be everything!
hello there!, hey i tried what you told me and it worked , but uh theres a little problem, the badge isnt showing up, theres no errors in the output, everything works but when i click on the buttom the badge doesnt show up and doesnt appear in my inventory either, i changed OnServerEvent to OnClientEvent, i forgot to say my game is meant to be single player so i changed it to that, i dont OnClientEvent is causing the problem tho, but i feel like once again im missing something, btw thanks for the help, but do you know about this?
When you’re calling FireServer(), are you doing this on a LocalScript? Cause RemoteEvents can only transport data over from 1 area, to another different area
You can try and add some print statements as well (print("Test Message")) to debug the issue further, as you should have the LocalScript that calls FireServer(), and a ServerScript that receives it via .OnServerEvent
wait wait, how can i make ServerScriptService receive it via OnServerEvent? i dont get it, im not asking for the script but like can you explain it once again, sorry i still quite dont catch it, and yes im calling fireserver from a local script
Unfortunately, ServerScriptService has something that’s called “NOT REPLICATED”, as in you’re unable to access it from 1 side, while you can on another and vice versa
Examples being:
Attempting to index ServerStorage on a LocalScript
Finding a folder inside ServerScriptService
The client and the server are both, two different things individually
you need to set the Player variable as i don’t see a Player variable, also, in a server script you cannot use game.Players.LocalPlayer as it’s not a LOCAL script, so you would have to do script.Parent.Parent.Parent… and so on until you get to the player.
heres a script, create a remote event with the name of badgeevent or something else
local button = script.Parent
local event = game.ReplicatedStorage.BadgeEvent -- example, just use a remoteevent
button.MouseButton1Click:Connect(function()
event:FireServer()
end)
our script in serverscriptservice:
local event = game.ReplicatedStorage.BadgeEvent -- the same thing as last time
event.OnServerEvent:Connect(function(player) -- remember to put player
game:GetService("BadgeService"):AwardBadge(player.UserId, 4254040307)
end)