How do i make a value that apply to only the player without influence for other player? Ex: if the person do the quest give the money only for this player. LocalScript? Special location? Its really simple but i dont know what to do...
we need a Touched
function to do this which means we need debounce
so they can only get one point per touch and then remove the part we touch
local player = game.Players.LocalPlayer local part = game.Workspace.Part -- the part to be touched to get objective local debounce = false function removePart() part:Destroy() end function addPoints() --add points end part.Touched:Connect(function() if not debounce then debounce = true addPoints() wait() removePart() -- remove the part so they can only get points / the objective once debounce = false end end)
well, you need some sort of data keeper, such as a leaderstat or just another number,string, and etc values to keep track of the progress of the player.
but in this example, i assume that you use a leaderstat.
game.Players.PlayerAdded:Connect(function(plr) local stat = instance.new("Folder",plr) stat.Name = "leaderstat" local cash = instance.new("IntValue",stat) cash.Name = "Cash" end) function playerFinishedQuestOrWhatever(plr) local points = 20 local stat = plr:WaitForChild("leaderstat") local cash = stat.Cash cash.Value = cash.Value + points end
this will only add points to a specific player so when you call playerFinishedQuestOrWhatever()
and give it a player object as an argument., it will only add points to that player's cash
this is just an example of how you could do it... for more help go here