Hello, i have a shop script and Its a local script, the script to take away the money is server, i send a remote event to the server script to remove money but that makes all the tools the same price, any help with changing the price of a tool in a remote event? or someway to update the server script money take away?
You’re going to have to post code for us to be able to help you.
sorry i forgot i went to do something.
server script
Remote.OnServerEvent:Connect(function(player)
if (player.Currency.Value - 5) >= 0 then
player.Currency.Value = player.Currency.Value -5
else
print("Not enough.")
end
end)
Buy script
local Remote = game:WaitForChild("ReplicatedStorage"):WaitForChild("Shop"):WaitForChild("BuySkin")
script.Parent.MouseButton1Click:Connect(function()
if (game.Players.LocalPlayer.Currency.Value - 5) >= 0 then
local SearchForTool = game.Workspace.Skins:WaitForChild(script.Parent.Parent.Parent.NameOfMonster.Value.Name)
local Found = SearchForTool:clone()
local Tool = game.Players.LocalPlayer.Backpack:FindFirstChild(script.Parent.Parent.Parent.NameOfMonster.Value.Name)
if not Tool then
script.Parent.Parent.Parent.NameOfMonster.Value:WaitForChild("Owned").Value = true
Found.Parent = game.Players.LocalPlayer.Backpack
Remote:FireServer()
else
print("Dont have enough.")
end
end
end)
i would need the prices to change for each item selected but idk how to pass it to a server script from a local without using remote event but idk how to change price
You can send arguments through the FireServer method and then use them on the server.
To do this:
Remote:FireServer(Arg1, Arg2, Arg3))
You can then use them on the server by adding the extra arguments to your connecting function.
Remote.OnServerEvent:Connect(function(player, Arg1, Arg2, Arg3)
if (player.Currency.Value - 5) >= 0 then
player.Currency.Value = player.Currency.Value -5
else
print("Not enough.")
end
end)
Please keep in mind this is just an example of how you would use it, and what I wrote is not an attempt at solution. To change the price of each item selected, you could send the values across the server and client using remote events with the prices being sent as arguments in this way.
is there a way i can pass a Object value?
You can send Objects (Instances) through Remote/Bindable Events & functions. Remote Events & Parameter Limitations. I would personally recommend against this if the object has not been explicitly replicated to both the client and the server.