How to make a Kill to earn money system?

i actually changed line2 so the print statement works

then take this and edit line 2 and tell me ( afk some time )

local Players = game:GetService("Players");

script.Parent.Humanoid.Died:Connect(function()
	local playerWhoKilled = script.Parent.Humanoid:FindFirstChild("creator").Value
	print(playerWhoKilled)
	Players[playerWhoKilled].data.Cash.Value += math.random(70,120)
end)

i’m sorry

but you literally shouldn’t be making systems like these if you don’t even know the basics of client/server communication

i appreciate the ambition, but this is far out of your skill level
please do something easier

the only way you’re going to make this work is by being spoonfed, and let me tell you from experience, you do not want to be spoonfed

i don’t really get need of remote events so i didn’t learn them

.
.
.
.
.

please tell me you’re joking
no comment besides that

fine ill learn remote events .

dude,

what the hell do you mean “fine”
what’s up with the attitude??

you want to have client/server communication, and you don’t use remote events??
are you like, crazy?

remote events are literally a MUST have, with no workaround to them, when you want to communicate like that
unless you want your game to be entirely client-based, also resulting in exploiters

and to my knowledge, clients CAN’T even access datastores, they need to request data from the server,

and how do you request data? oh yeah, via a REMOTE EVENT

this is literally the craziest thing i’ve seen so far in my 3 years of game developing

This same question must be here 50 times over … I’ve even helped a few compleate it.
Just look around Step #1.

You’re wrong.

You CAN make a game without using even a single remoteevent!

How?

Use remote functions.
:stuck_out_tongue:

(Sorry for the joke. Please report this post.)

1 Like

from friend to friend, that was a bad joke

keep trying though, it’s the thought that counts giggle giggle

EDIT:

remote functions??
aren’t those just remote events witha different name?

nope remote function is like

server>client>server
client>server>client

I know… I suck at making jokes because I spend most my time on studio.

Not really, remote functions just end up sending data back. So graphically it’s like:

Remote Events:
Client > Server / Server > Client.

Remote Functions:
Client > Server > Wait for server to process data and use a return > Client.

1 Like

so did it work or not is there an error ( if it works can u give me a solution )

also nots7d is right, it is impossible to make a good game without remote events

playerwhokilled is not a valid member of players and infinite yeild possible (i tried using wait for child function but it didn’t work)

wait can u try the attribute one instead of creator tag the one i sent before

it printed nil
30char30char30c

can u show the script now how it looks like

local Players = game:GetService("Players");

script.Parent.Humanoid.Died:Connect(function()
	local playerWhoKilled = script.Parent.Humanoid:GetAttribute("LastHitBy");
	print(playerWhoKilled)
	Players[playerWhoKilled].Data.Cash.Value += math.random(70,120)
end)