Hello

I'm making a button that when pressed it resets the kills and deaths stats in the leaderboard. However this doesn't work. I think my remote event doesn't work for somehow.

local script (This is under the button in the startergui)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ResetEvent = ReplicatedStorage:WaitForChild("ResetEvent")

script.Parent.MouseButton1Click:Connect(function()
	ResetEvent:FireServer()
end)

Normal script (This is in the server script service


print("Hello World")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ResetEvent = Instance.new("RemoteEvent",ReplicatedStorage)

ResetEvent.Name = "ResetEvent"

Players = game:GetService("Players")
print("variables work")
local function onResetEventFired()
		print("Reset Event fired")
		for i, player in pairs(Players:GetPlayers())do
		player.leaderstats.KOs.Value = 0
		player.leaderstats.Wipeouts.Value = 0
		print("Stats reset")
	end
end

print("Test")
ResetEvent.OnServerEvent:Connect(onResetEventFired)
print("The script read this")

I tried to add prints to debug the hello world and variables work print works, when pressing the buttons the other prints also still don't work.

Can someone help me?

Kees

1 comment

0

It works now :)