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

Would I need to use remote events to code a money giving chest?

Asked by 2 years ago

I am making a money giving chest that gives money when you click it, so would I need a remote event to do the money giving to prevent hackers or no? (The script is a server script, not a local one)

(I am new to scripting)

3 answers

Log in to vote
0
Answered by 2 years ago

Well since I am guessing it's a one time thing I don't think you would be needing one anyway if you are thinking of the :FireServer() event it would not work since it is a server script to a server script. And I don't think a hacker would do it anyway so in my opinion just use a regular script in workspace.

Good luck!

Ad
Log in to vote
0
Answered by 2 years ago

You won't need any remote events, the hackers are not really capable of exploiting a server script, instead, they are able to exploit a remote event by firing it and giving themselves money, which is not what we want.

Since i think you are using a ClickDetector object, that is the child of the part to be clicked, this would be a example script of what could be the result (script will be a server script, as a child of the part to be clicked):

local MoneyVal = 10 --The amount of money that will be given to the player

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
--when the event fires, it returns the player who clicked the part
plr.leaderstats.Money += MoneyVal 
--Finds where the money IntValue(or other) is located, and adds to it the money that we will give
end)

Remember that remote events main goal is to make client (or local scripts) actions and changes to be visible to the server, or vice versa, to make server actions happen in all the clients (or players), or to a single client.

As i said, hackers could get benefit of this by firing the remote event that gives money, unless you make a "hacker-protection" code.

Hope this helps, feel free to ask any questions!

Log in to vote
0
Answered by 2 years ago

No, you don't.

Because it wouldn't make a difference due to hackers being able to run that remote event anyway. Since it's in a server script, too, then it will apply for every player, because it's being sent to the main server, so that explains that.

Answer this question