#Can't collect blocks if they're level is too high

1 messages · Page 1 of 1 (latest)

spring plover
#

Slime Collector tool local script
` -- Variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("SlimeAdd")

local slimeCollector = script.Parent
local handle = slimeCollector.Handle
local collectionPart = slimeCollector.CollectionPart
local slime = game.Workspace.GreenSlime
local slimeTouchPart = slime.Exterior
local slimeSFX = slimeCollector["Slime Jump"]

-- Main Function
slimeCollector.Activated:Connect(function(player)
slimeCollector.Enabled = true
collectionPart.Touched:Connect(function(hit)
local slimeLevel = hit.Parent:FindFirstChild("SlimeLevel")
if slimeLevel.Value == 0 then
if hit.Parent.Parent:FindFirstChild("GreenSlime") then
if hit.Parent:FindFirstChild("Exterior") then
hit.Parent:Destroy()
slimeSFX:Play()
remoteEvent:FireServer()
slimeCollector.Enabled = false
script.Enabled = false
wait(.5)
slimeCollector.Enabled = true
script.Enabled = true
else
print("Slime level too high")
end
end
end
end)
end) `

#

Slime Collector tool server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("SlimeAdd")

remoteEvent.OnServerEvent:Connect(function(player)
    if player:FindFirstChild("leaderstats") then
        local slime = player.leaderstats:FindFirstChild("Slime")
        local slimeBonus = player.leaderstats:FindFirstChild("Slime Bonus")
        if slime then
            slime.Value = slime.Value + 1 + slimeBonus.Value
        end
    end
end)


#

leaderstats


local function leaderboardSetup(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local slime = Instance.new("IntValue")
    slime.Name = "Slime"
    slime.Value = 0
    slime.Parent = leaderstats
    
    local money = Instance.new("IntValue")
    money.Name = "Money"
    money.Value = 0
    money.Parent = leaderstats
    
    local slimeBonus = Instance.new("IntValue")
    slimeBonus.Name = "Slime Bonus"
    slimeBonus.Value = 0
    slimeBonus.Parent = leaderstats
    
    local upgradePrice = Instance.new("IntValue")
    upgradePrice.Name = "Tool Upgrade Price"
    upgradePrice.Value = 150
    upgradePrice.Parent = leaderstats

end

Players.PlayerAdded:Connect(leaderboardSetup)```
#

I understand my local script isn't how I should go about doing this but I have no other ideas

topaz pecan
#

not a single word on whats exactly not working

spring plover
#

haha sorry its js like not working in general

#

not doing what its supposed

#

to