Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

somebody hit the part script does something for some reason is not working does not show any errors?

Asked by 3 years ago
Edited 3 years ago

script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local cash = plr.leaderstats.Cash cash.Value = cash.Value +5 R:FireAllClients() print('Recived') end)

---This part it is in Replicated storage, I made a script that when you click a part, the part in replicated storage (this one) duplicates and goes to Workspace and when a player hits it what it says in the script is what it does. But is not doing anything.

0
wait so what does that script do exactly? Pitched_mobile 191 — 3y
0
im guessing it gives cash to someone and does someone else on all clients Pitched_mobile 191 — 3y
0
It deletes a part that the player has in its right hand, gives player 5 more of cash, fire a remote event and destroy its parent. iREY90089 2 — 3y
0
and it just does nothing? Pitched_mobile 191 — 3y
View all comments (6 more)
0
Yeah, wait, I changed something but it still does not work iREY90089 2 — 3y
0
u cant give cash in a localscript Pitched_mobile 191 — 3y
0
Is in a script. iREY90089 2 — 3y
0
a script in a brick? Pitched_mobile 191 — 3y
0
well still it has to fire a remote event to the server and from there u can manage the currency Pitched_mobile 191 — 3y
0
Is in a brick, also the remote event connects to 4 localscripts. iREY90089 2 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

just use a new remote event to fire to the specific user for the cash

script.Parent.Touched:Connect(function(hit)


        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        local cash = plr.leaderstats.Cash
    NewEvent:FireServer
        R:FireAllClients(plr)
        print('Recived')

    end)


script in serverScriptService

NewEvent.OnServerEvent:Connect (function(player)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5
end)
Ad

Answer this question