Also for the output part, where are you putting the script? It should be placed inside of a server script which would go in ServerScriptService.
Fire a remote to remove credits if you want it to replicate.
I dont need the tools to save, i just need the credits to stay away. (Meaning not to give a refund)
How would I do that? I dont how to fire the event.
Use :FireServer() on the remote.
I know that part, but in between the parenthesis what do I write. Or i just leave it empty
So something like this
player = game.Players.LocalPlayer
backpack = player.Backpack
script.Parent.MouseButton1Click:Connect(function()
local SpeedCoil = game.ReplicatedStorage.Tools.SpeedCoil:Clone()
if player.leaderstats.Credits.Value >= 100 then
player.leaderstats.Credits.Value = player.leaderstats.Credits.Value - 100
SpeedCoil.Parent = backpack
game.ReplicatedStorage.RemoteEvent:FireServer()
end
end)
end)
What I would suggest is on server, listen to the remote, remove the credits and parent the speedcoil to the player’s backpack.
So you want the credits to be taken away when they purchase something using it?
you can remove the speedcoil part on client and the credit removing too, just do it on server
Yea, like it takes it away but when they rejoin it somehow comes back
That’s not possible unless you make another DataStore system which stores previous data.
If this can’t be fixed and no one gives me any answer by Thursday, i will give u solution since u helped me sooo much
No they can just get the current data, remove a value then save it.
Okay well I can try to get something done for you, thanks again.
Sorry for not responding, I have two things that you need to read and this should help with saving the tools.
If you want your players to get their tools back when they die, you can simply modify the script which gives the player the tool, and clone the tool to add to their StarterGear. You can read more about StarterGear here
And as for saving the player’s backpack tools to an DataStore you may read this separate Community Tutorial which focuses more in depth on how to do so.
I’ll mark u as solution even though I don’t need tool saving, it’s like tower of hell once u buy a tool for credits and u die, it’s gone (which is good and what I want) but the credits coming back are the problem…
Hm so when the player dies after buying the tool, the credits are restored?
when they leave. I want it so that It never restores.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.