#I genuinely do not know whats wrong here

1 messages · Page 1 of 1 (latest)

true badger
#
local plrs = game:GetService("Players")
local Rs = game.ReplicatedStorage
local CheckpointEV = Rs.CheckpointEv
local part = game.Workspace.Part

plrs.PlayerAdded:Connect(function(plr, leaderstats)
    local leaderstats =  Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    
    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 0
end)

CheckpointEV.OnServerEvent:Connect(function(plr)
    part.Touched:Connect(function()
        local leaderstats = plr:WaitForChild("leaderstats")
        if leaderstats then
            local CheckPoint = leaderstats:WaitForChild("Checkpoint")
            if CheckPoint then
                CheckPoint.Value += 1
            end
        end
    end)
end)

That one handles the leaderstats logic
this one handles firing the event, it is a localscript in sps:

local part = game.Workspace.Part
local CheckpointEV = game.ReplicatedStorage.CheckpointEv

part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        CheckpointEV:FireServer()
    end
end) ```
#

please

tawny plank
#

skidded gg

gloomy cargo
calm parrot
true badger
#

But its in the workspace folder

#

Idk if its a bug

calm parrot
#

are u good

#

learn from your father

true badger
#

the leaderstats isnt working

calm parrot
true badger
#

ok

warm sentinel
#

I can try to help

true badger
#

idk if its the way i used

#

But i have seen code where they do that?

#

plr, leaderstats

warm sentinel
#

leaderstats isn't a parameter of playeradded

#

remove leaderstats

true badger
#

So i just parent it normally?

warm sentinel
#

make the variable a folder not a parameter

calm parrot
#

dude

#

why are you guys still talking

calm parrot
#

@true badger run the code I've sent above

#

you're all good after that

warm sentinel
#
local plrs = game:GetService("Players")
local Rs = game.ReplicatedStorage
local CheckpointEV = Rs.CheckpointEv
local part = game.Workspace.Part

plrs.PlayerAdded:Connect(function(plr)
    local leaderstats =  Instance.new("Folder", plr)
    leaderstats.Name = "leaderstats"
    
    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 0
end)

CheckpointEV.OnServerEvent:Connect(function(plr)
    part.Touched:Connect(function()
        local leaderstats = plr:WaitForChild("leaderstats")
        if leaderstats then
            local CheckPoint = leaderstats:WaitForChild("Checkpoint")
            if CheckPoint then
                CheckPoint.Value += 1
            end
        end
    end)
end)
true badger
#

OHHH

warm sentinel
#

why?

#

it should work

calm parrot
#

no

#

it's wrong @true badger

warm sentinel
#

whats wrong with it

true badger
#

lol

warm sentinel
#

yeah

#

lol

calm parrot
#
local plrs = game:GetService("Players")
local Rs = game.ReplicatedStorage
local CheckpointEV = Rs.CheckpointEv

plrs.PlayerAdded:Connect(function(plr)
    local leaderstats =  Instance.new("Folder", plr)
    leaderstats.Name = "leaderstats"
    
    local Checkpoint = Instance.new("IntValue", leaderstats)
    Checkpoint.Name = "Checkpoint"
    Checkpoint.Value = 0
end)

CheckpointEV.OnServerEvent:Connect(function(plr)
    local leaderstats = plr:WaitForChild("leaderstats")
    if leaderstats then
        local CheckPoint = leaderstats:WaitForChild("Checkpoint")
        if CheckPoint then
            CheckPoint.Value += 1
        end
    end
end)
true badger
#

Tysm @warm sentinel

calm parrot
warm sentinel
#

yw :D

true badger
calm parrot
#

??

warm sentinel
calm parrot
#

you're putting a cookie batter inside the oven then switching on oven and then removing the batter immediately to put it back inside

#

dude

warm sentinel
# true badger Tysm <@491935029946220554>

the problem is that you tried to make a parameter called leaderstats and didn't parent the actual leaderstats folder anywhere, so it just sat there as an instance without any parent

calm parrot
#

you're firing the remote event from ls to server side

#

why the hell will you use Touched event in server side again

#

wdym why not

gloomy cargo
#

Yep

gloomy cargo
#

Keep being delusional

calm parrot
#

honestly

#

you dont even need remote event to do this task

#
part.Touched...
 if ... and FindFirstChild("Checkpoint") then
    ...
 elseif .. and not :FFC("Checkpoint") then
    .Instance.new("IntValue")
    ...
 end
end)
#

no

gloomy cargo
#

S0 talking btw

#

;compile

tropic ermineBOT
#
Critical error:

You must attach a code-block containing code to your message or quote a message that has one.

calm parrot
gloomy cargo
#

;compile ```lua
print(0>math.random(1,4))

tropic ermineBOT
#
Program Output
false

gloomy cargo
calm parrot
#

I have nothing to say

#

how

gloomy cargo
#

Give me 10 mins

#

S0 talking to me btw

warm sentinel
#

this guy literally said thank you already

true badger
#

because it was @warm sentinel who helped me