So I am attempting to add a line in a script that increases the player's "Cash" by a specific amount but how do I make the script below a valid member of a player?
game.Players.PlayerAdded:connect(function(plr)
local stats = Instance.new("BoolValue",plr)
stats.Name = "leaderstats"
local cash = Instance.new("IntValue",stats)
cash.Name = "Cash"
cash.Value = 0
end)
Also, below is the script that I am trying to make give the cash to the player
leave = game.Workspace.leave
workspace.NPC1.Head.Dialog.DialogChoiceSelected:connect(function(player,choice)
if choice.Name == "Choice1" then --If the player takes the order
player.Character.Torso.Anchored = false --Test (does nothing atm)
game.Players.LocalPlayer.cash.Value = game.Players.LocalPlayer.Cash.Value +5
wait(3)
player.Character.Torso.Anchored = false --Test (does nothing atm)
elseif choice.Name == "Choice2" then --If the player does not take the order
player.Character.Torso.Anchored = false --Test (does nothing atm)
wait(1)
player.Character.Torso.Anchored = false --Test (does nothing atm)
script.Parent.Parent.Parent.Humanoid.WalkToPoint = game.Workspace.leave.Position
wait(5)
script.Parent.Parent.Parent:Destroy()
end
end)

2 comments
So, you're trying to make ur first script be in StarterGui or just straight under the player?
That script I have in the Workspace.