Hi, I’m making a difficulty chart Obby. I want to make a server message like [User] has completed [Difficulty] whenever they complete a difficulty.
I already have something scripted, however it doesn’t work.
Current code:
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local server = ChatService:AddSpeaker("Server")
server:JoinChannel("All")
server:SetExtraData("NameColor", Color3.fromRGB(0, 255, 0))
server:SetExtraData("ChatColor", Color3.fromRGB(0, 255, 0))
script.Parent.Touched:Connect(function(hit)
local char = game.Players:GetPlayerFromCharacter(hit.Parent)
if char then
local name = char.Name
if game.Players[name].leaderstats.Stage.Value == 10 then
server:SayMessage(char.Name.." has completed Effortless!", "All")
end
end
end)
The problem with that, is that when they touch the next checkpoint they are already at stage 11. I only want it to chat it once they complete it, not every time they join and touch it.
Thanks!
It’ll do the same thing anyway. You could just check the leaderstats.
Checking If they are on 10 doesn’t work, because the stage changes before the if executes.
There has to be some sort of workaround without complexity (eg. storing values)