I really need help this is the cherry to the cake for my game that sounded cheesy ignore that but I’ve made the cash on kill script My leader stat for money is coins anything could help thank you for spending your time and reading this
Please don’t duplicate posts! Also, could you provide more information?
What do you mean?
Ok sorry about the duplicate that’s a whole different story but basically I’m making a killing simulator I want to make it so if you have a gun you get 25 coins per kill and if you have the rocket launcher you get 50 coins per kill do you want me to add more info?
What have you tried? do you have any code to show us?
ok I have some code I had no hope in it at all So I didn’t try in it there’s so many things wrong in this code that’s why I’m looking for help poq
I think you just need to check the tag’s name. If it is a gun then award… If it is a rocket launcher then award…
ok how do I put that into script
So, I am assuming there is a script that makes the leaderstats?
Yes that script is in the workspace
I’d insert that script into ServerScriptService if I was you.
Now, when you close off the function like this: game.Players.PlayerAdded:Connect(function(player)
and you press Enter, the script should automatically add the end)
with the closing bracket. But your script does not.
Try doing this: Make the gun create a value inside the enemy called like the player name and as value the exp gained value, if you re-hit and you find the value you don’t create it again but increase the value of it, make it so when the enemy dies the experience is given to the players that created a value inside it.
Base on your script(starting from the tag variable):
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
local stats = tag.Value:WaitForChild("leaderstats")
if tag.Value == "your gun name here" then
stats["Coins"].Value = stats["Coins"].Value + -- your value here
elseif tag.Value == "your other gun name here" then
stats["Coins"].Value = stats["Coins"].Value + -- your value here
end
end
This should work I think.
I copied and pasted a bit because it was in a local script and that format was stuffed for some reason
The script won’t work inside a localscript. Localscripts can do game.Players.PlayerAdded
but you can’t set the coins in the client. Put it in a script inside ServerScriptService and put all the code in one script, since they server similar functions.
I’ll try it thanks so much for the help
ok I’ll retry it thank you thanks so lich
Would I put the ID of the gun or the Name I’ll see what works but I think the is will work anyway thanks so much this helps me and my game so much I’ll try it out tomorrow.
Ok thanks I’ll try that… I’m just doing dogs to make it longer so it wil let me type it because it’s to short
Didn’t work thanks for helping anyway
I had the same problem and found no resolution