#Script Not Working
1564 messages · Page 2 of 2 (latest)
oh
🤯
ye
try it
what erro
oh wait
mb
since its an intvalue
u just gotta add
.Value
so u can just add to the variable
player.leaderstats.Coins.Value
Coins.Value = Coins.Value + 50 works but its more time consuming
m
show me the whole script
that is
local water = workspace.Part
local tool = script.Parent
local sound = water.sound
water.ProximityPrompt.Triggered:Connect(function(player)
water.ProximityPrompt.Enabled = false
local Coins = player.leaderstats.Coins.Value
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animationLoaded = humanoid:LoadAnimation(water.ProximityPrompt.Animation)
local tool = player.Backpack.Mop
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
tool.CanBeDropped = false
animationLoaded:Play()
sound:Play()
wait(5)
animationLoaded:Stop()
sound:Stop()
humanoid.WalkSpeed = 18
humanoid.JumpPower = 50
Coins.Value = Coins.Value + 50
end)
alr bet
is u gud
okk
its something you just added
LETS GO
AYYYY
🤯
try it
error?
no error
it just doesnt add?
yeah
wat
yk how?
yeah switch to server
then go find
your leaderstats
then the coins
it should be under
click on coins
try change it
i think
** You are now Level 8! **
tell
theres actually 2 type of "Players"
in game
one is the player model which is the character
i mean
yeah but
if u go in workspace
u can see ur player model
then in players, the player
this is actually getting
the player model
so what u gonna do
make a variable
to get the game:GetService("Players")
then
get the player
and it should work
yes
ok where
then
for the coins variable
u put
u add players
in front
of player
so
players.player.blahblah
i dont get it
what u dont get
idk what to do
o
so u see ur coins variable
change it too players.player.leaderstats.Coins.Value
alr bet
if that doesnt work i might know why but we try first
WaitForChild?
no
uhh
thats a different thing
[" "]
like that
no
oh
instead of the .
whats that
it does the same thing
give me an example
what does that mean
what does FindFirstChild mean
so
Find first child means
finds the first children with the name in the given part
in this case
finds the first thing thats named Coins
you will use it a lot
in the future
its same as wait for child
except it only fires onces
oh
while wait for child will keep waiting
yeah
does it still not work
ok where do I put it
so
ye
:FindFirstChild("Coins")
yeah
I changed it from Coins to coins btw
coins
of the int value then
just coins
try it
doesnt work
what error
nothing
debugging time
then print players[player.Name].leaderstats
u gotta bracket it
print must have
print()
ye
but not coins???
weird
try to print coins
oh
players[player.Name].leaderstats.coins
ye
what???
idk
lets see 😭
ye
local water = workspace.Part
local tool = script.Parent
local sound = water.sound
local players = game:GetService("Players")
water.ProximityPrompt.Triggered:Connect(function(player)
water.ProximityPrompt.Enabled = false
local coins = players[player.Name].leaderstats:FindFirstChild("coins").Value
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animationLoaded = humanoid:LoadAnimation(water.ProximityPrompt.Animation)
local tool = player.Backpack.Mop
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
tool.CanBeDropped = false
animationLoaded:Play()
sound:Play()
wait(5)
animationLoaded:Stop()
sound:Stop()
humanoid.WalkSpeed = 18
humanoid.JumpPower = 50
coins += 50
print(players[player.Name])
print(players[player.Name].leaderstats)
print(players[player.Name].leaderstats.coins)
end)
yk what maybe try removing the .Value
uhhhhhh
from the variable
so chatgpt said
players[player.Name].leaderstats.coins.Value = players[player.Name].leaderstats.coins.Value + 50
instead of
thats what we did bro
wATh
then do coins.value = coins.value + 50
what is going on bro
IDKK
and make it clone itself
ye
well
its simple but
listen
lets say someone spawns right
there is 5
differnet ones
or 10
depending on map
im thinking a bathroom
yeah
theres a code that does all of that
so
its better if u watch yt
but ill explain
in short
alr bet
you got that water part right
wdym
the part
yea
yea
ye
ye
you will have to have another script
in server script service
to make it clone
the part
in server storage
every like how many how many
so i adivse u go learn
how to clone
you know how to use vector3?
uhh nah
that u also gotta go yt
vector3 is pretty simple
ye
ye
[""]
ye
no idea whats it called
you can google it but
basically why we do this
instead of . just now
yes
players[player.Name].leaderstats.coins.Value```
is because
if you were to do
players.player
it would try to find
a instance called player
under players
if you were to do players.player.Name
it would try to find
an instance called player
under players
and try to find an instance
called Name
under player
but if you were
to do this [ ]
mhm
you can get your variables
instead
and if your part names have a space
lets say
your part is called
Toilet Water
you could not do
game.Workspace.Toilet Water
OH
cause it doesnt like spaces incode
so instead
you could do
["Toilet Water"]
this one you need to quotes
honestly
coding in general
you should never have
spaces
in the names of any part
or any instance
ye lol
just use _
where u at
im at california
💀
its 1pm for me
im not even american
WW I love malaysia
but im not malay
are u muslim?
no
ohhh
im chinese
but i dont really speak chinese
ye i feel u bro
cool
yeee
ok bye man
np
I really appreciate it
👍

bro Ryan u were helping me from 7:49pm to 1:01am
thats like
5 hours

@icy lance
yesterday i fell asleep
but I kinda learned a bit about vector3
its the placement right?
X, Y, and Z axis. Right?
yes
yk?
not rrlly
math.random(0,1)
yeah ik that
yeah but
I want like
specific
placements
I dont want it spawning
off the map
vector3.new(x,y,x)
u can put the numbers so like
vector3.new(math.random(0, 50), 10, math.random(0,50))
you dont have to set all of it to random
so confusing
math.random(-50,50)
uhh
if u want like really specific
then
uh
ig put a part and drag it to where u want it
then see the x y z
pro
alr
** You are now Level 12! **
1559 is crazy
yeah
