#how do i make leaderboard display a saved currency called kills?
1152 messages · Page 2 of 2 (latest)
👀
ss
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
im not sure
THINK MEN
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)
yes
, but it's related to this
cloud can't leave the function?
wym can't leave the functiojn
The function is contained
it can leave the function
freely
as long as you send it onwards
which you're doing
not enough ends?
the connect event happens before its made?
im confused
Remote.OnClientEvent:Connect(SoundFire)
function SoundFire()
end
where is the mistake
it's a logical mistake
not a mistake in code
Does it have to do with the placement top to bottom
yes
remote should be under
yes
the connect
squish goes first
yes
shouldnt it only happen if you use local function
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
why two squish men
why cant he just use it as a function instead of a local function
so he can access it everywhere on thes cript
bad practice
not really
when he learns modules its not gonna matter
local goal = {Instance.Size*2}
so we need to know the instance size before we run that command?
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
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
ok
instance.size
Instance.size
squishable.size?
squishable.Size
thats what im saying
he used instance.size instead of squishable.size
and instance doesnt exist
only squishable was passed with the type of instance
cannot cast dictionary
squishable has a different error this time
TweenService:Create(squishable,TweenInfo,goal):Play()
do
this line
just do
local goal = {
['Size'] = squishable.Size*2,
}```
totally not mental hospital code
local goal = {Size = squishable.Size*2}
pyn ur close
@fleet nacelle @noble patrol IT LOOKS GOOD
i gotta do that fast then
you already did everything basically
i will ping you tomorrow if thats ok
👍
fun