Hello,
In my last topic people said I had to use remote functions, so no exploiters can give themself as much cash as they want.
Now i’ve been trying to use remote functions for my game with help from the developers hub. And I found this script but it gives an error.
This is the error:
Here’s the script;
-- Server
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPopupRequest = Instance.new("RemoteFunction")
createPopupRequest.Name = "CreatePopupRequest"
createPopupRequest.Parent = ReplicatedStorage
Players.CharacterAutoLoads = false
local function onPlayerAdded(player)
createPopupRequest:InvokeClient(player)
player:LoadCharacter()
end
Players.PlayerAdded:Connect(onPlayerAdded)
-- ==================================================
-- LocalScript
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local createPopupRequest = ReplicatedStorage:WaitForChild("CreatePopupRequest")
local function onCreatePopupRequested()
local screen = Instance.new("ScreenGui")
screen.Parent = playerGui
local closeButton = Instance.new("TextButton")
closeButton.Text = "Welcome to the game! Click me to play!"
closeButton.Size = UDim2.new(0, 300, 0, 50)
closeButton.Parent = screen
closeButton.MouseButton1Click:Wait()
closeButton.Visible = false
end
createPopupRequest.OnClientInvoke = onCreatePopupRequested
I know that this script is copied from the dev hub but I just wanted to learn about remote functions.
Now what I want to do with remote functions is;
- When a player clicks the purchase button and he got less cash then the amount that the item cost it will say ‘You don’t have enough cash to buy this!’. But if he do got enough cash then this needs to happen ‘This will cost $300 Are you sure?’ and then when the player clicked the purchase button it has to clone.(the cloning progress i already have I just want to know how I can do this with remote functions so no hacker/exploiter can give themself cash.
(@devjden said that if you do everything locally exploiters can give themself as much as they want. So thats why I want to change this.) But is it ok to dom somethings locally like when a player clicks a button etc? If yes then I probably need to change that too .
Please help me with this!