Part gives you 1 point only

Hi guys, so i saw this script from youtube and… the youtuber said that it will give 1 MFound “Point” 1 time

But when i leave and rejoin, i still can get it
So i want this like
A brick or something gives you 1 MFound “aka: point”, even if you leave and rejoin

here is my script Screenshot by Lightshot

and can you please Write the full script of it? And thanks you!

We would rather not write a whole script (Support, not spoon feeding) but you can use the Database that roblox comes with to check if the player has already got the point or not (Data Stores | Roblox Creator Documentation)

1 Like

Ooo… let me try that real quick

The devforum isn’t a place to ask for entire scripts, what you’re looking for is Datastores basically storing data for a specific user even after they leave. Then when they rejoin load their data, which will contain how much parts they have touched. Loop through all the touched parts and set some kind of state to “Touched” which will disable their ability to get that point again. If a non-touched part is touched update their in-game data which will be stored to the datastore once they leave(the touched data can be true/false values for each part/point).

1 Like

i turn it on and still didnt work

If you aren’t going to try and learn how to make a game then it obviously won’t work.

Here is a script for the data-storage, but I am not spoon-feeding you the rest.

local Plrs = game:GetService("Players") -- gets the player service.
local Dts = game:GetService("DataStoreService") -- gets the datastore service.
local points = Dts:GetDataStore("points") -- gets the datastore that stores the points

function LoadPlayerData(player)
	local success, err = pcall(function() -- creates a pcall
		local ID = player.UserId -- the ID of the user
		local PlayerPoints = points:GetAsync(player.UserId) -- User's datastore
		if not PlayerPoints then -- checks if the user has data saved
			PlayerPoints = 0 -- gives data to the user
		end
		local leaderstats = Instance.new("Folder") -- makes a leaderboard
		leaderstats.Parent = player
		leaderstats.Name = "leaderstats"
		local IntHolder = Instance.new("IntValue") -- shows the points on the leaderboard
		IntHolder.Name = "points"
		IntHolder.Parent = leaderstats -- puts it on the leaderboard
		IntHolder.Value = PlayerPoints -- puts the value as the saved value
	end)
	if not success then 
		warn(err)
	end
end

function SavePlayerData(player)
	local success, err = pcall(function() -- creates a pcall
		local ID = player.UserId
		local pointV = player.leaderstats.points.Value -- player's points
		points:SetAsync(ID,pointV) -- saves the player's points
	end)
	if not success then 
		warn(err)
	end 
end

Plrs.PlayerAdded:Connect(LoadPlayerData)
Plrs.PlayerRemoving:Connect(SavePlayerData)

Remember to have Studio access to API services on!
image

Edit: I tested the script and it works perfectly fine. There should be no reason why it doesn’t work. Unless you forgot to enable Studio Access to API services.