#Script Not Working

1564 messages · Page 2 of 2 (latest)

icy lance
#

thats one part of it

steel marlin
#

oh

icy lance
#

🤯

steel marlin
#

WAIT

#

WHATS THE OTHER PART

icy lance
#

remember what u named the int value

#

it wasnt money

#

it was Coins

steel marlin
#

ye

icy lance
#

since u named it coins

#

when you go in game

#

go to the player

steel marlin
#

am I him

icy lance
#

and click their leaderstats

#

no way

#

🤯

steel marlin
#

OMH

#

LETS FOOOOGOGOGOGOGOOGOGOG

icy lance
#

try it

steel marlin
#

BET

#

ok so the animation and everything works

#

but

#

error

icy lance
#

what erro

steel marlin
icy lance
#

oh no

#

math

steel marlin
icy lance
#

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

steel marlin
icy lance
#

m

steel marlin
icy lance
#

show me the whole script

steel marlin
#

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) 
icy lance
#

imma let u find

#

the error

steel marlin
#

alr bet

icy lance
#

is u gud

steel marlin
#

ok this is hard 15Sob

#

hint

#

not answer

#

but hint

icy lance
#

ok

#

coins

steel marlin
#

okk

icy lance
#

its something you just added

steel marlin
icy lance
#

LETS GO

steel marlin
#

AYYYY

icy lance
#

🤯

steel marlin
#

LETS FLIPPING

#

GOO

#

YESSIRRR

icy lance
#

try it

steel marlin
#

HFAHBFAYFGAYFG

#

alr

#

SHIT

#

doesnt work

icy lance
#

error?

steel marlin
#

no error

icy lance
#

it just doesnt add?

steel marlin
#

ye

#

should we say

#

print(Coins.Value)

icy lance
#

yeah

steel marlin
#

alr

icy lance
#

wat

steel marlin
#

lmao

icy lance
#

wait

#

go in game

#

switch to server

steel marlin
#

ye

#

huh

icy lance
#

yk how?

steel marlin
#

how

#

oh wait

#

client server

#

yes i know

icy lance
#

yeah switch to server

#

then go find

#

your leaderstats

#

then the coins

#

it should be under

steel marlin
icy lance
#

game.Players

#

click on players

#

the arrow

steel marlin
icy lance
#

click on coins

steel marlin
#

ye

#

value = 0

icy lance
#

try change it

steel marlin
#

alr

icy lance
#

i think

polar ingotBOT
#

studio** You are now Level 8! **studio

icy lance
#

i knoww

#

the error aleady

steel marlin
#

tell

icy lance
#

theres actually 2 type of "Players"

#

in game

#

one is the player model which is the character

steel marlin
#

ye

#

and then localplayer

icy lance
#

i mean

#

yeah but

#

if u go in workspace

#

u can see ur player model

#

then in players, the player

icy lance
#

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

steel marlin
#

ok

#

local = game:GetService("Players")

#

local players = game:GetService("Players")

icy lance
#

yes

steel marlin
#

ok where

icy lance
#

then

#

outside

#

of the function

steel marlin
#

ok bet

#

done

icy lance
#

then

#

for the coins variable

#

u put

#

u add players

#

in front

#

of player

#

so

#

players.player.blahblah

steel marlin
#

i dont get it

icy lance
#

what u dont get

steel marlin
#

idk what to do

icy lance
#

o

icy lance
steel marlin
#

ye

#

local coins = ...?

#

ye

icy lance
#

change it too players.player.leaderstats.Coins.Value

steel marlin
steel marlin
icy lance
#

if that doesnt work i might know why but we try first

steel marlin
icy lance
#

ya

#

wait

steel marlin
icy lance
#

hold on

#

so imma teach u a new thing

#

u know how get the children by using .

steel marlin
#

WaitForChild?

icy lance
#

no

steel marlin
#

uhh

icy lance
#

thats a different thing

steel marlin
#

yeah ik

#

ProximityPrompt.Sound

icy lance
#

[" "]

steel marlin
#

like that

icy lance
#

no

steel marlin
icy lance
#

instead of the .

steel marlin
#

whats that

icy lance
#

we can use

#

[""]

#

tbh

#

i have no idea 💀

#

i found it it works

steel marlin
#

LOL

#

alr bet

icy lance
#

it does the same thing

steel marlin
#

give me an example

icy lance
#

ok

steel marlin
icy lance
#

no need the ""

#

i will explain why later

steel marlin
#

ye alr

icy lance
#

what

#

try

#

:FindFirstChild("Coins")

steel marlin
#

what does that mean

icy lance
#

it does the same thing

#

as

#

.

#

but better

steel marlin
#

what does FindFirstChild mean

icy lance
#

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

steel marlin
#

oh

icy lance
#

while wait for child will keep waiting

steel marlin
#

yeah

icy lance
#

does it still not work

steel marlin
#

ok where do I put it

icy lance
#

so

icy lance
#

replace the

#

.Coins

#

to

steel marlin
#

ye

icy lance
#

:FindFirstChild("Coins")

steel marlin
#

alr trying rn

icy lance
#

yeah

steel marlin
#

I changed it from Coins to coins btw

icy lance
#

o

#

whats the actual name?

steel marlin
#

coins

icy lance
#

of the int value then

steel marlin
#

just coins

icy lance
#

then it has to be the same

#

coins instead of Coins

steel marlin
#

ye ik

#

i changed it

#

check

icy lance
#

try it

steel marlin
#

doesnt work

icy lance
#

what error

steel marlin
#

nothing

icy lance
#

debugging time

steel marlin
#

LOL

#

why was that

#

nvm 15Sob

#

yea debugging time

icy lance
#

ok so

#

see if it got print

steel marlin
icy lance
#

u gotta bracket it

#

print must have

#

print()

steel marlin
#

oh yeah

#

good

#

?

icy lance
#

yeah

#

try it

steel marlin
#

alr bet

icy lance
#

so it does get

#

the leaderstats

#

and the player

steel marlin
#

ye

icy lance
#

but not coins???

steel marlin
#

weird

icy lance
#

try to print coins

steel marlin
#

alr

#

lemme try

icy lance
#

like

#

ok

steel marlin
#

like dis?

icy lance
#

no

#

i mean

steel marlin
#

oh

icy lance
steel marlin
#

alr bet

icy lance
#

ye

steel marlin
icy lance
#

what???

steel marlin
#

idk

icy lance
#

and it doesnt

#

add

steel marlin
icy lance
#

ok try

#

instead of

#

coins = coins + 50

#

do

#

coins += 50

steel marlin
#

omg bru

#

what does that mean

icy lance
#

plus by istelf i think

#

idk

#

googled

#

💀

steel marlin
#

bet i did it

#

doesnt work

#

should I ask chatgpt

icy lance
#

i mean

#

if it works?

steel marlin
#

lets see 😭

icy lance
#

can i see ur code again

#

like the full thing

steel marlin
#

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) 
icy lance
#

yk what maybe try removing the .Value

steel marlin
#

uhhhhhh

icy lance
#

from the variable

steel marlin
#

so chatgpt said

#

instead of

icy lance
#

thats what we did bro

steel marlin
#

no

#

but instead

#

of

#

coins+= 50

icy lance
#

ok

#

try ig

steel marlin
#

holy shit

#

it works

icy lance
#

wATh

steel marlin
#

LLOL

#

IM CRYING

icy lance
#

anyways i was gonna say

#

remove .Value

steel marlin
icy lance
#

then do coins.value = coins.value + 50

steel marlin
#

YE

#

I WAS THINKING THAT TOO BROO

#

HOLY

icy lance
#

what is going on bro

steel marlin
#

IDKK

icy lance
#

crazy

#

anyways yeah

#

now if u want to delete the part

steel marlin
#

ye alright now

#

ye

icy lance
#

and make it clone itself

steel marlin
#

ye

icy lance
#

well

steel marlin
#

different area

#

wait i need a

#

look

#

i want multiple

icy lance
#

its simple but

steel marlin
#

listen

icy lance
#

a lot

#

yeah

steel marlin
#

lets say someone spawns right

#

there is 5

#

differnet ones

#

or 10

#

depending on map

#

im thinking a bathroom

icy lance
#

yeah

#

theres a code that does all of that

#

so

#

its better if u watch yt

#

but ill explain

#

in short

steel marlin
#

alr bet

icy lance
#

you got that water part right

steel marlin
#

wdym

icy lance
#

i mean

#

the thing u mop

steel marlin
#

the part

icy lance
#

yea

steel marlin
#

yea

icy lance
#

dont do it yet but

#

you gotta put that in server storage

#

it will become invisible

steel marlin
#

ye

icy lance
#

serverstorage just stores anything to server side

#

then

steel marlin
#

ye

icy lance
#

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?

steel marlin
#

uhh nah

icy lance
#

DAM

#

ok

steel marlin
#

LOL

#

WHAT

icy lance
#

anyways

#

what you gotta learn

#

is

#

Cloning

steel marlin
#

ye

#

also

#

i need data saving

icy lance
#

that u also gotta go yt

steel marlin
#

ye

#

bet

#

u gtg?

icy lance
#

vector3 is pretty simple

steel marlin
#

ye

icy lance
#

and i will explain the

#

[] this thing

steel marlin
#

ye

icy lance
#

[""]

steel marlin
#

ye

icy lance
#

no idea whats it called

#

you can google it but

#

basically why we do this

#

instead of . just now

steel marlin
#

yes

icy lance
#
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

#

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 [ ]

steel marlin
#

mhm

icy lance
#

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

steel marlin
#

OH

icy lance
#

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

steel marlin
#

ye lol

icy lance
#

just use _

steel marlin
#

fr

#

alr so

#

ima go learn the cloning rq

#

and the data saving

icy lance
#

yeah

#

imma head out bro

#

bye

steel marlin
#

alr what time

#

is it for u

#

rn

#

@icy lance

icy lance
#

5pm

#

why

steel marlin
#

god damn

#

where u at bro

icy lance
#

where u at

steel marlin
#

im at california

icy lance
#

💀

steel marlin
#

its 1pm for me

icy lance
#

im not even american

steel marlin
#

12:59AM rn

#

oh bro cool

#

i hate america

icy lance
#

💀

#

ok bro

#

im from malaysia

steel marlin
#

WW I love malaysia

icy lance
#

but im not malay

steel marlin
#

are u muslim?

icy lance
#

no

steel marlin
icy lance
#

im chinese

steel marlin
#

oh cool

#

i have a lot of

#

chinese friends

icy lance
#

but i dont really speak chinese

steel marlin
#

ye i feel u bro

icy lance
#

cool

steel marlin
#

i speak fluent arabic

#

im from Yemen

#

but live in california

icy lance
#

wo

#

nice

steel marlin
#

yeee

icy lance
#

ok bye man

steel marlin
#

bye bro

#

thanks for the help

icy lance
#

np

steel marlin
#

I really appreciate it

icy lance
#

👍

drifting night
steel marlin
#

@drifting night WSP BRO

#

I DID SOO MUCH WITH RYANISONDISCORD

steel marlin
#

@drifting night

#

bro

steel marlin
#

thats like

#

5 hours

steel marlin
#

@icy lance

#

yesterday i fell asleep

#

but I kinda learned a bit about vector3

#

its the placement right?

#

X, Y, and Z axis. Right?

icy lance
#

yes

steel marlin
#

yeah and the random placement

#

I didn't really catch on to that

icy lance
#

yk?

steel marlin
#

not rrlly

icy lance
#

math.random(0,1)

steel marlin
#

yeah ik that

icy lance
#

then

#

think of it as its own number

steel marlin
#

yeah but

#

I want like

#

specific

#

placements

#

I dont want it spawning

#

off the map

icy lance
#

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

steel marlin
#

so confusing

icy lance
#

math.random(-50,50)

steel marlin
#

uhh

icy lance
#

basically

#

math.random(from, to)

steel marlin
#

how do I find

#

cordinates

icy lance
#

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

steel marlin
#

alr

polar ingotBOT
#

studio** You are now Level 12! **studio

icy lance
#

anyways im boutta do my own stuff so

#

go yt

steel marlin
steel marlin
#

alr

warm cave
#

1559 is crazy

steel marlin
#

wdym 1559?

#

1559 messages?

warm cave
#

yeah