#how do i make leaderboard display a saved currency called kills?

1152 messages · Page 2 of 2 (latest)

noble patrol
#

and see what happens

warped meadow
#

im going to say yes

#

but if so

#

WHY IS IT BLUE

noble patrol
#

👀

warped meadow
#

attempted to call a nil value

#

and it listed all the info on "PynMan"s body parts

noble patrol
#

ss

warped meadow
#

ok

noble patrol
#
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("SoundPlayEvent")

Remote.OnClientEvent:Connect(SoundFire)

function SoundFire()
    if FireClient fires SoundPlayEvent play BoingSound
end
#

this code is from yesterday

#

you made the same mistake here

#

what is the mistake

warped meadow
#

im not sure

noble patrol
#

THINK MEN

warped meadow
#
function Jump(hit,cloud)
    if hit.Parent:FindFirstChild("Humanoid") then -- check if humanoid variable is humanoid instance
        local humanoid = hit.Parent.Humanoid -- can already use .humanoid because it exists!
        local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
        Remote:FireClient(player,"Sound",Sound)
        humanoid.JumpHeight = cloud:GetAttribute("JumpHeight") -- set jumpheight to the attribute value
        humanoid.Jump = true
        task.wait(.5)
        humanoid.JumpHeight = 7.2
        squish(cloud)
    end
end

#

the issue

#

is here

#

with how i wrote squish(cloud)

noble patrol
#

yes

warped meadow
#

cloud can't leave the function?

noble patrol
#

wym can't leave the functiojn

warped meadow
#

The function is contained

noble patrol
#

it can leave the function

#

freely

#

as long as you send it onwards

#

which you're doing

noble patrol
#

that's not the problem there

#

@warped meadow code is executed from top to bottom

warped meadow
#

im confused

noble patrol
#
Remote.OnClientEvent:Connect(SoundFire)

function SoundFire()
    
end
#

where is the mistake

#

it's a logical mistake

#

not a mistake in code

warped meadow
#

Does it have to do with the placement top to bottom

noble patrol
#

yes

warped meadow
#

remote should be under

noble patrol
#

yes

warped meadow
#

the connect

noble patrol
#

you're trying to call a function

#

which hasnt been created

#

yet

warped meadow
#

im trying to call squish

#

but squish doesn't yet exist

noble patrol
#

yes

#

so

#

how do you fix the problem

warped meadow
#

squish goes first

noble patrol
#

yes

fleet nacelle
#

shouldnt it only happen if you use local function

warped meadow
#
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("SoundPlayEvent")
local Sound = game.ReplicatedStorage.Sounds.BoingSound
local TweenService = game:GetService("TweenService")

local function squish(squishable:  Instance)
    local TweenInfo = TweenInfo.new(2, Enum.EasingStyle.Bounce, Enum.EasingDirection.In,0, true, 0)
    local goal = {Instance.Size*2}
    TweenService:Create(squishable,TweenInfo,goal):Play()
end


function Jump(hit,cloud)
    if hit.Parent:FindFirstChild("Humanoid") then -- check if humanoid variable is humanoid instance
        local humanoid = hit.Parent.Humanoid -- can already use .humanoid because it exists!
        local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
        Remote:FireClient(player,"Sound",Sound)
        humanoid.JumpHeight = cloud:GetAttribute("JumpHeight") -- set jumpheight to the attribute value
        humanoid.Jump = true
        task.wait(.5)
        humanoid.JumpHeight = 7.2
        squish(cloud)
    end
end


local cloudtable = {} -- create a table for the clouds

for _,instance in game.Workspace:GetDescendants() do -- for each descendant in workspace
    if instance:GetAttribute("JumpHeight") then -- check if they have an attribute called JumpHeight
        table.insert(cloudtable,instance) -- insert the instance into the table if they do
    end
end

for _,cloud in cloudtable do -- go through each cloud in cloudtable
    cloud.Touched:Connect(function(hit) -- start a function when a cloud is .Touched
        Jump(hit,cloud) -- 
    end)
end


local function squish(squishable:  Instance)
    local TweenInfo = TweenInfo.new(2, Enum.EasingStyle.Bounce, Enum.EasingDirection.In,0, true, 0)
    local goal = {Instance.Size*2}
    TweenService:Create(squishable,TweenInfo,goal):Play()
    end
noble patrol
#

why two squish men

warped meadow
#

wait two squish

#

ooop

#

ok second squish gone

fleet nacelle
#

so he can access it everywhere on thes cript

noble patrol
#

bad practice

fleet nacelle
#

not really

noble patrol
#

unnecessary data storing

#

unless you're using it EVERYwhere

fleet nacelle
#

when he learns modules its not gonna matter

noble patrol
#

and if you are

#

use module scripts

warped meadow
noble patrol
#

it takes up memory for no reason

#

so

#

what is line 16

warped meadow
#

local goal = {Instance.Size*2}

#

so we need to know the instance size before we run that command?

noble patrol
#
local function squish(squishable:  Instance)
    print(squishable)
    local TweenInfo = TweenInfo.new(2, Enum.EasingStyle.Bounce, Enum.EasingDirection.In,0, true, 0)
    local goal = {Instance.Size*2}
    TweenService:Create(squishable,TweenInfo,goal):Play()
end
#

replace it with this

#

and see what it prints

warped meadow
noble patrol
#

ok we are going to do a fun thing

#

called enabling output

#

go into roblox studio

#

click the View tab

#

and click on Output

#

and re do the whole process

warped meadow
#

ok

noble patrol
#

and then ss the output window

#

instead of the console

#

its just insanely flooded

warped meadow
#

its getting a nil value

#

i gotta start getting ready in about 10 mins

#

for work

noble patrol
#

ah

#

I know why

fleet nacelle
#

instance.size

noble patrol
#

Instance.size

fleet nacelle
#

instead of squishable.size

#

fix that before u go to work

#

please

noble patrol
#

no

#

squishable

#

instead of instance

warped meadow
#

squishable.size?

noble patrol
#

squishable.Size

fleet nacelle
#

he used instance.size instead of squishable.size

#

and instance doesnt exist

#

only squishable was passed with the type of instance

warped meadow
fleet nacelle
#

cannot cast dictionary

warped meadow
#

squishable has a different error this time

fleet nacelle
#

check the line it esnt you to

#

instead of asking us

noble patrol
#

its the tween goal

#

ah

warped meadow
#

TweenService:Create(squishable,TweenInfo,goal):Play()

noble patrol
#

do

warped meadow
noble patrol
#
local goal = {}
goal.Size = squishable.Size *2
#

my bad

noble patrol
#

or ```lua
local goal = {Size = squishable.Size*2}

#

either one

#

works

fleet nacelle
#
local goal = {
  ['Size'] = squishable.Size*2,
}```
noble patrol
#

disturbing

#

formatting

fleet nacelle
#

totally not mental hospital code

warped meadow
#

local goal = {Size = squishable.Size*2}

fleet nacelle
#

pyn ur close

warped meadow
noble patrol
#

yh

#

gotta adjust it a bit

#

so it's not so delay

#

but there's still a problem

warped meadow
#

i gotta do that fast then

noble patrol
#

nah

#

you can skip that for now

#

do it next time

warped meadow
#

ok

#

alright

noble patrol
#

you already did everything basically

warped meadow
#

i will ping you tomorrow if thats ok

noble patrol
#

👍

warped meadow
#

(i will be gone till 2 am my time)

#

(i work 3:30pm to 2am)

#

ok bye bye

noble patrol
#

fun

warped meadow
#

thank you a lot

#

you and 3875 (i will not say his name) are good help