Points system doesn't work

Hey this is my first post. Im new at proggraming and i ran into a problem that i cant find a solution for.

  1. What do you want to achieve? Keep it simple and clear!
    I am making a small game where two random players from the players in the sever being chosen and being teleported to the map. The map changes every round. The goal for the players is the press the button, the first player who presses the button will get 10 points and the players will return toe the lobby.

  2. What is the issue?
    The issue is that when a player presses the button he doesn’t get any points. I don’t get any errors.

  3. What solutions have you tried so far?
    I’ve looked in the developer forum and many different tutorials and could not find an answer.
    Help would be much appriciated!
    Here is the system script:

Players = game:GetService("Players")
Teams = game:GetService("Teams")
local SpectateTeam = game.Teams.Spectate
local ItTeam = game.Teams.Blue
local RunnerTeam = game.Teams.Red
local roundlength = 8
local intermissionLength = 4
local inRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = workspace.Map.SpawnLobby
local MapSpawnIt = workspace.Map.SpawnMapIt
local MapSpawnRunner = workspace.Map.SpawnMapRunner
local frame = game.StarterGui.ScreenGuimenu.Frame
local KillerSpawn = workspace.Map.SpawnMapIt
local lobbyspace = workspace.Lobbyspace
local SurvivedPoints = 10
local time = 3

game.Players.PlayerAdded:Connect(function(player) 
	player.Team = SpectateTeam
end)


local function Cancollide() -- release players when round begins
	MapSpawnRunner.CanCollide = false
	MapSpawnIt.CanCollide = false
	wait(1)
	MapSpawnRunner.CanCollide = true
	MapSpawnIt.CanCollide = true
end

inRound.Changed:Connect(function(player)
	if inRound.Value == true then
		local chosen = Players:GetChildren()[math.random(1, #Players:GetChildren())]
		print(chosen)
		chosen.Team = ItTeam
		local runnerTeam = Teams.Spectate:GetPlayers()
		local runner = runnerTeam[math.random(1,#runnerTeam)]
		print(runner)
			runner.Team = RunnerTeam
			
		wait()
				runner.Character.HumanoidRootPart.CFrame = MapSpawnRunner.CFrame
		chosen.Character.HumanoidRootPart.CFrame = KillerSpawn.CFrame  
	
		
	local Obbys = game.ReplicatedStorage.Obbys
			local chosenobby = Obbys:GetChildren()[math.random(1,#Obbys:GetChildren())]
			print(chosenobby)
			local Copy = chosenobby:Clone()
			
			Copy.Parent = workspace.Map.ObbyFolder
			
			
			local Buttonred = Copy.ButtonRed.Button:WaitForChild("ClickDetector")
			local Buttonblue = Copy.ButtonBlue.Button:WaitForChild("ClickDetector")
			
			Buttonred.MouseClick:Connect(function()
				inRound.Value = false
			Copy:Destroy()
			end)
			Buttonblue.MouseClick:Connect(function()
				inRound.Value = false
			Copy:Destroy()
		end)
	

	end
	
	if inRound.Value == false then
		for _, player in pairs(game.Players:GetChildren(player)) do
			local char = player.Character
			char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
			player.Team = SpectateTeam
			if workspace.Map.ObbyFolder:GetChildren() then
				workspace.Map.ObbyFolder:ClearAllChildren()
				end
		end 
		
			end
end)



local function RoundTimer()
	while wait() do
		for i = intermissionLength, 0, -1 do
			inRound.Value = false
			wait(1)
			Status.Value = "Intermission:" .. i .."seconds left!"
		end
		
		if #Players:GetPlayers() >= 2 then
			wait(1)
			inRound.Value = true
			Status.Value= "Ready?"
			for b = time, 0, -1 do
				wait(1)
				Status.Value = b
			end
			Cancollide()
			for i = roundlength, 0, -1 do
				wait()
				Status.Value = i.." seconds left!"
				wait(1)
			end
			else 
			for i = intermissionLength, 0, -1 do
				inRound.Value = false
				wait(1)
				Status.Value = "Intermission:" .. i .."seconds left!"
				end
			end
	end
end
spawn(RoundTimer())
2 Likes

It seems you only added inRound.Value = false
but not yourmoneyvalue = yourmoneyvalue + 10

2 Likes

I’m sorry i forgot to mension that i scripted the points system in other script cause i tried many different ways.
this is the points system script:

Players = game:GetService("Players")
local Event = game.ReplicatedStorage:WaitForChild("GivePoints")

Event.OnServerEvent:Connect(function(player)
	player.leaderstats.Points.Value = player.leaderstats.Points.Value + 10
end)
1 Like

is it server-side or client-side? And what’s developer console output?

1 Like

It is a server-side. I dont know what’s developer console output

1 Like

F9 or this console on down of studio (if you have it)


1 Like

I do have the output. Why do you ask?

1 Like

If you have it, can you join game and tell me if something is in there? after you click button

1 Like

Yes of course give me one second and thank you!

1 Like

The function incrementing the points looks fine. The problem is likely that the event call isn’t being received. Mind showing us the LocalScript that fires the RemoteEvent?

2 Likes

zerovaskr is right, can you show us? maybe you didn’t call it? or you called it from server?

1 Like

It written in local script in the button mesh

local Event = game.ReplicatedStorage:WaitForChild("GivePoints")

local player = game.Players.LocalPlayer

local clickdetector = script.Parent

clickdetector.MouseClick:Connect(function()

Event:FireServer()

end)
1 Like

is this script in clickdetector or in button? (if its in button change parent to clickdetector)

1 Like

Also i joined into the game in test mode and i didn’t get any errors except when i joined its showing me loadingstring is not available

1 Like

The script is in the clickdetector

1 Like

click the button and keep eye on thing that exploiters can give points without even playing

1 Like

Now i found that your variable “time” in main script is called like a function, maybe changing it will help

1 Like

ClickDetector MouseClick events can be received from the server, so there’s no need to use a RemoteEvent here. You can skip this step entirely and just for listen for ClickDetector.MouseClick in the same script that increments the points.

1 Like

A better way of doing this is:

player.leaderstats.Points.Value += 10
1 Like

no difference except its easier to type it and it isnt proffesional and value = value + 1 is better because it would get “patched” if any error first and more chance it will work

1 Like