If you’re trying to fire this remote when the LocalScript is in the Workspace, it will not run. You also don’t need to fire a remote event to increase the leaderstats when a part is touched. You can handle this all in a normal script without the use of a RemoteEvent, as seen in the code example below. This also minimizes the risk of exploiters firing a RemoteEvent that will give them more points. In a lot of cases, you do actually have to use a RemoteEvent for Client - Server or Server - Client communication but in this case it’s not necessary, and can all be handled in a normal server script.
---> Script inside the part that is going to be touched
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.Level.Value += 1
end
end)
Yeah so then that won’t run because it’s a descendant of the workspace. You could put a normal script as the child of the part instead:
local db = false
local cooldown = 0.5
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and db == false then --check if it is a character
db = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent) --get the player from the character
player.leaderstats.Level.Value += 1
wait(cooldown)
db = false
end
end)