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

how can i change a player's clothes in a shop without changing everyone's clothes? [closed]

Asked by 5 years ago

this script is supposed to charge a player 10 money to change their clothing however it charges every player in the server 10 money and changes their clothing too but if i use a localscript it would only make the new clothing visible to the player who bought it and wouldn't charge them any money

01game.Players.PlayerAdded:Connect(function(player)
02    local clickDetector = script.Parent
03    script.Disabled = false
04 
05    local function onMouseClick()
06        local oldchat = game.ReplicatedStorage.npcchatyesno:Clone()
07        oldchat.Parent = player.PlayerGui
08        local oldwalkspeed = player.Character:WaitForChild("Humanoid").WalkSpeed
09        local oldjumppower = player.Character:WaitForChild("Humanoid").JumpPower
10        player.Character:WaitForChild("Humanoid").WalkSpeed = 0
11        player.Character:WaitForChild("Humanoid").JumpPower = 0
12        local chatbox = player.PlayerGui.npcchatyesno
13        chatbox.Frame.TextBox.Text = "Would you like to buy the Assassin Rags for 10 rupees?"
14        chatbox.Frame.ButtonYes.Text = "Yes"
15        chatbox.Frame.ButtonNo.Text = "No"
View all 52 lines...
0
Do you mind if you shortened the code and added frequent comments? Also if you have published the place, can you please link it? Thanks. User#30567 0 — 5y
0
Try using a remoteevent, and have it fired by the client, and not the server. NightmareMcPro87 30 — 5y

Closed as Non-Descriptive by hiimgoodpack, ForeverBrown, EmbeddedHorror, and maumaumaumaumaumua

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?