Hello,
So i’ve been working with remote functions lately, so no hacker/exploiter can give themself cash.
But I want to have the cloning script in the server script so it can return the cloned model when the player clicks the purchase button and that it checks if the player has enough cash to buy it.
And if they have enough cash then the model will be getting cloned from replicated storage.
Can someone help me with this?
(The scripts arent putted in one script yet!)
Here’s the cloning script;
local tvclone = game.ReplicatedStorage.Tvs.OldTv.PartsOfOldTv:Clone()
tvclone.Parent = game.Workspace
local position = game.ReplicatedStorage.Tvs.OldTv.PartsOfOldTv.Screen
for i, v in pairs(tvclone:GetChildren()) do
v.Anchored = false
v.CanCollide = true
v.Transparency = 0
end
-- positions
local rotatepositionCFrame = CFrame.Angles(0,math.rad(0), 0)
position.CFrame = position.CFrame:ToWorldSpace(rotatepositionCFrame)
print("The CFrame has been set")
wait(30)
print("30 Seconds are over!")
script.Parent.Parent.Parent.BackGround.OldTv.PriceSetter.Visible = false
script.Parent.Parent.Parent.BackGround.OldTv.Selection.Visible = true
script.Disabled = false
print("PurchaseScript has been enabled")
Here’s the server script; in this script needs to be the cloning script too.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartRequest = Instance.new("RemoteFunction")
createPartRequest.Parent = ReplicatedStorage
createPartRequest.Name = "CreatePartRequest"
local function onCreatePartRequested(player)
return -- the cloned model idk if I need to usse metatables to put all the cloning lines into one name.
end
createPartRequest.OnServerInvoke = onCreatePartRequested
Here’s is the client script;
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartRequest = ReplicatedStorage:WaitForChild("CreatePartRequest")
script.Parent.Activated:Connect(function()
local (-the name of the model-) = createPartRequest:InvokeServer(game:GetService("Players").LocalPlayer)
end)