Hello,
So i’m trying to use the script from client to server from the developers hub, but I don’t know how I can make it that when a player clicks a button that something gets cloned. I already have it that the model gets cloned but I need to put it in a other script for the remote function. So no exploiter/hacker can give themself cash.
Can someone help me with this please?!
Here’s are both scripts local and normal;
-- LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartRequest = ReplicatedStorage:WaitForChild("CreatePartRequest")
local newPart = createPartRequest:InvokeServer()
print("The server created this part for me:", newPart)
-- ==================================================
-- Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartRequest = Instance.new("RemoteFunction")
createPartRequest.Parent = ReplicatedStorage
createPartRequest.Name = "CreatePartRequest"
local function onCreatePartRequested(player)
print(player.Name, "wants to create a new part")
local newPart = Instance.new("Part")
newPart.Parent = game.Workspace
return newPart
end
createPartRequest.OnServerInvoke = onCreatePartRequested
Btw, where does the local script needs to be in? In the purchase button?