#code-discussion

1 messages · Page 54 of 1

raw hollow
#

uhhh

#

man he is stupid

#

no u

#

my teammate

#

he removed the whole script

#

yeah ill just work on it, sorry for the waste of time have a good day.

frigid thorn
#

No worries

somber vault
#

Theirs no audio, I suggest adding some music and mabye captions so they know what to do

#

Mabye even a voice over

wicked herald
#

can i get some help with a code?

pearl blaze
#

If I remove the instance will it be removed in overlap/raycast params?

#

I'm worried about a memory leak

bleak glade
limpid shale
#

Workspace.Cow.Beef.Script:15: attempt to index nil with 'WaitForChild'

#

how can i fix this problem?

bleak glade
stuck radish
wicked herald
limpid shale
wicked herald
bleak glade
#

why do people do hit.parent

wicked herald
bleak glade
#

and not findfirstancestorwhichisa

wicked herald
#

cuz my code works like fully

#

but it gives me that error and when i respawn it doeesnt work

bleak glade
#

define the character as local Char = hit:FindFirstAncestorWhichIsA("Model") :: Model

#

then plug it in to find the player from the character

wicked herald
#

i added the var above

wicked herald
bleak glade
wicked herald
#

ahhhhhhh

limpid shale
#

how can i identifiy leaderstats then?

bleak glade
#

i dont know why hit.Parent is the "default" people think of for finding character from hit

#

the hit can be an accessory and end up being deeply nested

wicked herald
#

bro no way this fixed that

#

bruh thank you so so so so much

#

i have had this problem for like 4 days now

bleak glade
wicked herald
bleak glade
#

local character = hit:FindFirstAncestorWhichIsA("Model") :: Model

wicked herald
wicked herald
#

i want to know what it does

limpid shale
#

do i have to change "Model"?

bleak glade
wicked herald
bleak glade
#

2 or 4 could technically be the be the hit

#

maybe even an 8

#

i dont know how nested it gets

wicked herald
bleak glade
#

well not really i couldnt make that search on my own

#

thankfully roblox made it steamhappy

wicked herald
#

yeah

#

anyways ty again i almost lost the motivation to work on this game i had gotten help from 4 different programmers and searched the entire internet

thick sluice
karmic coral
#

who scripts + does vfx i need sword effects for my game dm for details i pay per task

limpid shale
#

it couldnt identify leaderstats at all

thick sluice
#

?

bleak glade
#

just scroll up

thick sluice
#

yes

#

you said "hit.Parent"

bleak glade
#

why do people think hit.Parent is the best way to find the character

limpid shale
#

it still couldnt identifiy

#

dont blame me if i was dumb cryingdead

bleak glade
limpid shale
#

then from what?

wicked herald
#

ay bro i need another help

#

when i die and respawn the code doesnt work

#

but the gui is still there

bleak glade
wicked herald
#

yup it is supposed to become invisible

#

and teleport me back to the spawn

bleak glade
limpid shale
wicked herald
limpid shale
#

like a bug

bleak glade
bleak glade
wicked herald
#

what its doing is making the gui invisible but it isnt teleporting me back to the spawn

#

i tihnk the error is that the code cant identify the player after it dies

#

idk how to fix that

bleak glade
wicked herald
#

and when it respawns back

#

it becomes visible again is that right?

bleak glade
#

if thats what youre trying to do, yes

#

died, make it invisible, character added, its visible again

limpid shale
bleak glade
fringe barn
#

someone hire me!! i need money

fringe barn
ionic oar
limpid shale
ionic oar
#

so is there still a problem?

limpid shale
#

yes

ionic oar
#

what is the value of MeatVal

#

also the script is disabled

limpid shale
#

I enabled it first

limpid shale
ionic oar
#

make sure its not 0 and put a print after the if statement to see if exeuctions gets passed that if

limpid shale
#

it works when it is touched

#

but doesnt work when i try to make me get currency

ionic oar
#

then Meat doesn't exist

#

are you sure the leaderstats and leaderstats.Meat exists?

limpid shale
#

yes

#

I tried another way in the script

#

now the problem is the leaderstats

ionic oar
#

wym

limpid shale
#

when i touch the part, its sends me Workspace.Cow.Beef.MeatCollect:13: attempt to index nil with 'FindFirstChild'

ionic oar
#

what is the new code

limpid shale
ionic oar
#

you aren't checking if hit.Parent has a humanoid

#

add that to the if statement

limpid shale
#

still with the same error

#

Workspace.Cow.Beef.MeatCollect:13: attempt to index nil with 'FindFirstChild'

ionic oar
#

so it seems like leaderstats doesn't exist

lean ocean
#

if not Player then return end

#

there u go

#

or it's the leaderstats

ionic oar
#

i think its the leaderstats i doubt something with a humanoid thats not a player is touching this part

limpid shale
#

is it checking the charcter or the player?

#

wait

#

i think it worked

#

it worked

ionic oar
#

what did you change

limpid shale
#

I added what frosty said

#

its said the same error but somehow worked

proud idol
#
BeefModel.Touched:Connect(function(Hit : Model)
    local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
    if not Player then return end
    
    Player:FindFirstChild("leaderstats"):FindFirstChild("Meat").Value += Amount
end)
proud idol
cosmic schooner
#
function StartTutorial()
    print('starting')
    game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
    local cloned_element = UIs_Module.HighLight(Announcements_Frame)
    UIs_Module.updateTextLabel(cloned_element.Title, "This is where the announcements are made.")
    wait(3)
    UIs_Module.HighLight(nil)
    wait(2)
    step = 1
    UIs_Module.updateTextLabel(Announcements_Frame.Title, Orders[step])
    wait(3)
    step = 2
    UIs_Module.updateTextLabel(Announcements_Frame.Title, Orders[step])
    
    local beam = Instance.new("Beam", workspace)
    beam.Attachment0 = workspace.Forest_Map.Shack.Main.Chairs.Chair1.Seat.Attachment
    beam.Attachment1 = game.Players.LocalPlayer.Character.HumanoidRootPart.RootRigAttachment
    beam.Texture = "rbxassetid://51478209"
    game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
    
    repeat wait(.5) until set == true
    
    beam:Destroy()
    
    step = 3
    
    Announcements_Frame.Title.Text = "Good !"
    wait(1)
    Announcements_Frame.Title.Text = ""
    UIs_Module.updateTextLabel(Announcements_Frame.Title, Orders[step])
    Remotes.Tutorial:FireServer("NPC")
    
    repeat wait(.5) until step == 5
    step = 6
    UIs_Module.updateTextLabel(Announcements_Frame.Title, "Now if the players find your response correct or good they can vote for you to get gems.")
    
end
StartTutorial()

is this a good way to make a tutorial game ?

timber bramble
#

idk

proud idol
#

theres not really a true definite right way

wicked herald
#

could i myabe get some help with this

chrome thicket
#

is anyone willing to volontear to help me with something

bleak glade
wicked herald
spark yarrow
#

guys can yall name me a fair price for someone to optimize a roblox obby? im not good at scripting

wicked herald
#

but when i reset the gui doesnt teleport me back to spawn

#

when i click on it

#

it does remove the gui when i click on it but doesnt teleport me

bleak glade
wicked herald
#

and the teleport and resetting the gui lines and in the same function

proud idol
bleak glade
#

why do you have nested touched events

proud idol
#

oh wait

wicked herald
proud idol
#

nvm im stupid nvm

wicked herald
#

OH NO

bleak glade
#

a touched event inside a touched event

wicked herald
proud idol
#

i guess it depends on how are they gonna recode ur obby

wicked herald
#

this my new code

spark yarrow
wicked herald
#

i was on some drugs before

bleak glade
#

still a little weird to nest a connection inside a connection like that

wicked herald
#

i made it better and removed the ones i didnt need

proud idol
bleak glade
#

yeah you could put that all on the client

wicked herald
#

like local scripts and in the starterplayerscripts?

bleak glade
#

yes

wicked herald
#

ah

bleak glade
#

or a replicaterdstorage script

#

that has client runcontext

wicked herald
#

alr ill try that maybe it fixes the problem

bleak glade
#

you can run normal scripts in the character too btw

proud idol
#

server would need to fire a remote that the client uses to reveal the leave game button

wicked herald
#

okay so the thing is

#

how do i refer to the part in my script

#

its in the starter player scripts now

#

before it was a children of the part

proud idol
wicked herald
#

so all i had to was script.parent

bleak glade
wicked herald
bleak glade
#

waitforchild

wet basalt
#

If a client call LoadAnimation on the animator which is server side, and then play the track, will the track also be replicated onto the server?

bleak glade
#

you can also make your code cleaner by using guard clauses

proud idol
wicked herald
bleak glade
#

if not player then return end, instead of if player then

wicked herald
#

i did this

#

its where the part is located

#

instead of script.parent

bleak glade
proud idol
wicked herald
#

should i do game.workspace:waitforchild?

bleak glade
#

no...

#

on the actual part

#

teleport

wicked herald
#

ahhhhhhhh

#

omg im dumb alr

wet basalt
spark yarrow
bleak glade
#

you shouldnt need multiple wait for childs, only one on a part like that

proud idol
bleak glade
#

and put it on the last one

wicked herald
#

may ik why wait for child is so important there?

bleak glade
proud idol
bleak glade
#

as its taking a copy from the server

wicked herald
#

ahhhhhhh

#

alr ty

proud idol
#

waitforchield yields the script (aka stops it) until the instnce is loaded or it timeouts if it cant find it

bleak glade
#

make sure you dont do something like game.Workspace["Teleportation Portals"]:WaitForChild("Portal2"):WaitForChild("Teleport")

#

you will only ever need one wait for child

#

and it would go on the last instance

wicked herald
#

okay so its glitching out

#

it teleports me to the spawn but my character like disappears

#

my camera is at the spawn but my character isnt

#

after 2 seconds i go to a random place and i can only see the sky

bleak glade
#

show the script again

wicked herald
bleak glade
#

still dont know why you nested your connections

wicked herald
#

im new to coding

#

my simple brain cant under this

bleak glade
#

a mousebutton1click is inside a touched connection

wicked herald
#

understand

wicked herald
bleak glade
#

yea

#

you can use a boolean and set it to true if they touchedi t

wicked herald
#

alr

#

okay if i do that then i cant access the variables above like char and player

#

how do i fix that

bleak glade
#

move it ouside the scope

#

you dont even need to define the character as the hit anymore, if its local it will already know

#

local Plr = game.Players.LocalPlayer

local Char = Plr.Character or Plr.CharacterAdded:Wait()

#

on characteradded redefine the character and humanoid if you use

wicked herald
#

alr

#

yep i fixed that

#

but there is still an error

#

the error isnt fixed i just teleport to a random place

wicked herald
bleak glade
#

you should be teleporting to that vector

wicked herald
#

alr im gon teleport to a different place lemme see

wicked herald
bleak glade
#

wait

#

it expects a cframe iirc

wicked herald
#

alr

bleak glade
#

Char:PivotTo(CFrame.new(Vector3.new(-9.348, 5.473, 32.468)) * CFrame.Angles(0, math.rad(90), 0))

wicked herald
#

alr trying it

#

oh

#

my

#

lord

#

it finally works

#

tysm brother

bleak glade
#

np

wicked herald
#

like for what reason it requires :pivotto

#

or cframe

#

and why not the humanoidrootpart's position

bleak glade
#

pivot is for moving the whole model i think

viral knot
#

Nobody is helping in code help so ima ask here

Anyone got an idea how to make it so when a user follows me and they rejoin they receive a prize like a pet in game for example ? And after they receive it they can’t get it again

#

If it’s even possible

bleak glade
#

cframes are 4x4 matrices

wicked herald
#

ahhhhh gotcha

bleak glade
#

| Right.X Up.X -Look.X Position.X |
| Right.Y Up.Y -Look.Y Position.Y |
| Right.Z Up.Z -Look.Z Position.Z |
| 0 0 0 1 | i think this is right

#

the 4th row is for the affine transformation iirc? hardly understand what it means but just know its usually 0 0 0 1

wicked herald
#

ah alr

#

ty

wicked herald
#

BUT THE THING IS STILL GIVING ME THE ERROR

#

OMG

bleak glade
# viral knot Nobody is helping in code help so ima ask here Anyone got an idea how to make ...
Players.PlayerAdded:Connect(function(player)
    local success, result = pcall(function()
        return HttpService:GetAsync("https://friends.roproxy.com/v1/users/"..player.UserId.."/followings")
    end)

    if success then
        local data = HttpService:JSONDecode(result).data
        local followsTarget = false

        for _, follow in pairs(data) do
            if follow.id == targetUserId then
                followsTarget = true
                break
            end
        end

        if followsTarget then
            player.TotalBoostLuck.Value = player.TotalBoostLuck.Value + 0.15
        end
    else
        warn("Failed to check follow status:", result)
    end
end) ```
#

make targetID your id and change the boost to whatever

bleak glade
wicked herald
viral knot
#

Ty

wicked herald
#

there is no error shown in the output but it isnt working

bleak glade
#

did you die when that happened?

wicked herald
#

after i respawn

bleak glade
wicked herald
#

and reset on spawn is disabled

wicked herald
#

i have been trying to do that but i found like 10 more errors and i fixed them but i cant fix the error that im trying to fix

bleak glade
wicked herald
#

bruh how do u do this shi 😭

bleak glade
#

wdym

wicked herald
#

ur just talented 😭

#

okay so i can understand everything except the plr.characteradded part

#

why did u add that

bleak glade
#

ty, look at documentation it helps learn roblox API

bleak glade
old atlas
#

Can y'all help me

wicked herald
#

what does newchar : model do?

bleak glade
#

when you die and dont add that, it was referencing the old character

bleak glade
old atlas
#

Where the scripts at

wicked herald
#

ohhh i see

bleak glade
#

the first param on characteradded is the character, saying : Model means its type is a model

wicked herald
#

replacing the old char with new

bleak glade
wicked herald
#

ooo

#

ty

#

oh yes it works now tysm

wild heath
#

a

deft pasture
#

yall im a solo dev, who wants to try my game i have really good system and i want to know any improvements on what to add?

thick sluice
#

⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⣴⠟⠋⠉⠀⠀⠈⠉⠙⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣴⠟⠁⠀⠀⢀⣀⣀⣀⠀⠀⠀⠈⠻⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣼⠃⠀⣠⡾⠛⠉⠀⠀⠉⠛⢷⣄⠀⠀⠘⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢸⡏⠀⢰⡏⠀⠀⠀⠀⠀⠀⠀⠀⢹⡆⠀⠀⢹⡇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣿⠁⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀⠀⠈⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣿⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣿⠀⠀⣿⠀⠀⢀⣀⣀⣀⠀⠀⠀⠀⣿⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⣿⠀⠀⠹⣆⠀⠘⠿⠿⠛⠁⠀⠀⣰⠏⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢿⡀⠀⠀⠙⠻⢦⣤⣤⣤⣤⠴⠞⠋⠀⠀⠀⢀⡿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠈⠻⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⠟⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠈⠙⠛⠒⠶⢤⣤⣤⣤⠤⠶⠒⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀

final cargo
#

i want to make a function that spawns in different types (like shopper, criminal etc) of npcs simultaneously
i was thinking about creating a thread, for each npc type, with a while true loop that spawns the npcs of its type every random seconds

#

can anyone help me on the best way to go about this

#

im not sure my idea is efficient

deft pasture
final cargo
#

wdym pacifically?

trim dove
#

Also where do I sell

craggy niche
deft pasture
#

like so you basically explained that you want an npc that spawns with a diffrent outfit randomly, correct?

final cargo
#

its not really a different outfit

#

its actually the action he's supposed to do

#

for example a shopper npc is going to go shopping

deft pasture
final cargo
#

a criminal npc is going to do criminal stuff

bleak glade
final cargo
#

yes

trim dove
static coral
craggy niche
final cargo
#

what im trying to do is similar to restaurant tycoon ,where each player has its own restaurant and each restaurant (im guessing) has its own npcSpawn function

#

the thing is, a game like restaurant tycoon would only have "eater" npcs

bleak glade
final cargo
#

and in my game i have airports instead of restaurants, so in an airport npcs do different stuff

deft pasture
final cargo
#

i mean the behavior is the same (following a pre-defined path), but different type = different path

static coral
final cargo
#

like, the "shopper" npcs should follow the path that leads them to the shop

bleak glade
#

if youre using subclasses just use polymorphism to override the existing spawnfunction on the main class

final cargo
#

the "eater" npcs should follow the path that leads them to the restaurant

final cargo
bleak glade
#

i thougght you said you were using oop

static coral
final cargo
bleak glade
#

polymorphism is the best use case for different functions that inherit off the main class

final cargo
#

i just pass the instance as the first parameter

bleak glade
#

it will automatically pass self

final cargo
bleak glade
#

none ive heard of

final cargo
#

i cant attach links

bleak glade
#

so your constructor passing in the mode such as criminal and shopper?

final cargo
static coral
final cargo
static coral
#

you are not using metatables so you can still use methods

final cargo
static coral
#

well either way even with metatables you can still use methods

final cargo
#

i am using methods just not directly on the instance

bleak glade
#

sounds like youre overcomplicating it

static coral
#

theres no point tho

final cargo
#

but it looks clear enough to me

#

can we go back to the npc problem pls btw lol

bleak glade
#

you dont have a constructor

#

so im not sure how to help

final cargo
#

i do

bleak glade
#

? i thought you werent using oop

final cargo
#

i am using oop

#

just not with metatables

bleak glade
#

ok interesting

final cargo
#

metatables just make it so u can call the methods directly on the instance

#

like npcInstance:getGender()

final cargo
#

the way i do it is Npc.getGender(npcInstance)

static coral
hasty mesa
#

metatables just make it so you don't have to store the methods in the same table

static coral
#

metatables are for manipulating/overriding table behaviour

final cargo
#

okay

bleak glade
#

i think using one would help you

static coral
final cargo
#

honestly i couldnt really understand metatables so i decided to use oop this way

bleak glade
static coral
final cargo
static coral
#

you should only be aware of their existance and use them when you reallyyyyy need to

static coral
final cargo
#

this is how i was doing it before with just one type of npc btw

#

don't mind the second parameter passed to loopSpawn()

#

i cut some code out

final cargo
#

so should i run on a single thread like i already am doing

static coral
# final cargo

put the npc types into an array and then choose a random number in the array and spawn the type at the chosen index

deft pasture
# final cargo

do you have it to where like npcs named female and the other male try to clarify it more in the code?

static coral
final cargo
thick sluice
final cargo
#

its just to know whether i should use a male model or a female one

final cargo
#

where a lot of people come in

#

in real life you have multiple people coming in at the same time you know

static coral
bleak glade
#

i told him not to use hit.Parent

static coral
final cargo
deft pasture
static coral
#

so if you want it to be faster then maybe make a constant at the top that specifies the amount of threads and then just create them in a for loop

thick sluice
#

this is beginner

final cargo
#

oh i see

static coral
bleak glade
bleak glade
#

so people stop using hit.parent

final cargo
#

so intead of having a thread for each type i just use N amount of threads to spawn various types

thick sluice
#

i am a beginner myself

#

and i dont find it bad habit

static coral
bleak glade
static coral
thick sluice
final cargo
#

with say 3 spawn threads for each

deft pasture
static coral
static coral
#

but the functions will

bleak glade
#

i have like 300k trheads in my game

static coral
#

if they are bad or have laggy stuff in them

deft pasture
#

lol

thick sluice
#

teaching my own kind

final cargo
#

in this case its just about following a certain path

#

that's pre-defined

#

its just a vector of cframes that the npc must reach

static coral
#

i think it would be fine

#

only 1 way to find out tho

deft pasture
bleak glade
#

cframes are 4x4 matrices

thick sluice
final cargo
#

for each cframe in vector do
reachCframe() --this waits until the cframe was reached
end

deft pasture
final cargo
#

tbh im using parts not cframes

#

i just thought cframes would be quicker to say

static coral
#

if it is predefined path it should be fine

bleak glade
#

vectors are better if you ydont need orientation

static coral
final cargo
bleak glade
#

yes cframes are 4x4 matrices that include rotation and the affine transformation

#

vectors are just 3 points

thick sluice
static coral
hasty mesa
#

either way only 1 thread can be running at a time

hasty mesa
#

in a vm

bleak glade
hasty mesa
#

yeah they would be paused most of the time

#

waiting to be resumed by either task.wait or whatever paused them

bleak glade
#

they dont have long execution times either

karmic coral
#

Dm me if u do death effects (no vfx needed just know cframes)
ill pay per task/effect

bleak glade
#

9 year olds shouldnt be on discord

next escarp
bleak glade
next escarp
karmic coral
next escarp
bleak glade
karmic coral
bleak glade
#

i have like 10 projects

bleak glade
karmic coral
next escarp
umbral carbon
umbral carbon
bleak glade
next escarp
#

I take most important decisions of my life in morning in bathroom idk why

umbral carbon
umbral carbon
bleak glade
next escarp
#

Okayyyyyyyyyyyy

umbral carbon
#

Might as well watch TV while taking a shower

trim dove
deft pasture
#

ohh phone is glitched lol but i fixed it

deft pasture
trim dove
deft pasture
#

uhm im still able to move and everything but my couch is not being a tool

deft pasture
#

@Someone

umbral carbon
fringe barn
#

sam!!!

umbral carbon
fringe barn
#

how ru sam

#

its been awhile

umbral carbon
fringe barn
#

gosh your always so funny with your jokes

#

dont be silly!

umbral carbon
#

🥶

fringe barn
#

😂

#

good one bro!

deft pasture
umbral carbon
#

Istg you guys have weird ideas

royal ibex
#

anyone know how to show orientation indicator?

silent niche
#

I have a question i am making a Skill With moon animator But Idk how to make the Vfx Visible how do i do it ?

latent cloak
#

the code help channel became the discussion one

#

sick

#

im dealing with this

mental zinc
#

whats the problem

latent cloak
#
local Slider = script.Parent
local Fill = script.Parent.Fill
local Trigger = script.Parent.Trigger


function UpdateSlider()
    local output = (Mouse.X-Slider.AbsolutePosition.X)/Slider.AbsoluteSize.X
        
    Fill.Size = UDim2.fromScale(output,1)
end 

local sliderActive = false

function ActivateSlider()
    sliderActive = true
    while sliderActive do
        UpdateSlider()
        task.wait()
    end
end

Trigger.MouseButton1Down:Connect(ActivateSlider)

game:GetService("UserInputService").InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        sliderActive = false
    end
end)```
#

im in the middle of a making a slider for a volume setting

mental zinc
#

i think i have a slider in one of my projects

#

i had to use a canvas group

#

for the bg frame

high stream
sharp lagoon
#

Is it good to use proximityprompt?

sharp lagoon
high stream
# latent cloak ```local Mouse = game.Players.LocalPlayer:GetMouse() local Slider = script.Paren...

local Mouse = game.Players.LocalPlayer:GetMouse()
local Slider = script.Parent
local Fill = script.Parent.Fill
local Trigger = script.Parent.Trigger

function UpdateSlider()
local output = (Mouse.X - Slider.AbsolutePosition.X) / Slider.AbsoluteSize.X
output = math.clamp(output, 0, 1) -- Clamp the value between 0 and 1
Fill.Size = UDim2.fromScale(output, 1)
end

local sliderActive = false

function ActivateSlider()
sliderActive = true
while sliderActive do
UpdateSlider()
task.wait()
end
end

Trigger.MouseButton1Down:Connect(ActivateSlider)

game:GetService("UserInputService").InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
sliderActive = false
end
end)

#

try that

sharp lagoon
high stream
#

yea what are u using it for

sharp lagoon
#

For example getting near a part it shows up billboard gui etc

#

And interacting with it

high stream
#

np

sharp lagoon
high stream
#

use the proximity prompt if ur a beginner since its easier

sharp lagoon
#

But what’s the best choice? Scripting it?

proud idol
#

you have more customization if u script it

high stream
#

wdym by best choice

sharp lagoon
#

Just overall

high stream
sharp lagoon
#

Idk 😭😭

high stream
#

i dont think it matters based on performance

sharp lagoon
#

Ooh alright

#

What do most people use? For interacting etc with billboard gui?

high stream
#

the proximity prompt

sharp lagoon
#

Alright thank youu

high stream
#

np

sharp lagoon
#

No…?

high stream
#

mistake

sharp lagoon
#

Haha jk ik

#

You use it aswell? The prompt?

high stream
sharp lagoon
#

I see

#

Oh wait but

#

I can’t customise the gui with it right?

proud idol
#

you can change its look

#

not the functionality

sharp lagoon
#

Hmmmm

#

Its functionality is holding E right?

proud idol
#

if u want a fast and easy way to add a button that can be pressed using keys/controller buttons is okay to use proximity prompt

#

but for more complicated stuff youll need to script it urself

sharp lagoon
#

Hmmmmm lemme think of an example

high stream
sharp lagoon
#

Okay what if I want the interaction to be with an image then?

#

Costume button

#

Oops typo

high stream
#

ive seen it be done but im not quite sure

sharp lagoon
#

Oh complicated right?

high stream
#

not sure

#

maybe watch a tutorial

proud idol
#

if i remember correctly

high stream
#

yea u can

sharp lagoon
#

Alright thank you, but if I use script instead it wouldn’t make much difference right if it works?

proud idol
#

you have to set a property so it uses a gui that its parented inside the proximity prompt

#

i dont remember that well cause i usually just use billboards

sharp lagoon
proud idol
#

again, proximity prompt is the quick and easy way to add a billboard button

#

but it doesnt do anything else other than what its designed for

#

Interactable Billboards is like the advanced mode of proximity prompt

sharp lagoon
sharp lagoon
#

Also module scripts, it’s used when you have a lot of scripts doing same thing right?

proud idol
#

yeah

#

one of its uses

sharp lagoon
#

What’s its 3 main uses?

proud idol
#

i personally use them more as like libraries tho

sharp lagoon
bleak glade
proud idol
# sharp lagoon Meaning?

library is essentially a collection of functions that a code can import from (so you dont have to write em into the code itself)

sharp lagoon
#

But isn’t library storing scripts then to use? That’s to prevent same scripts being duplicated bunch of times right?

sharp lagoon
bleak glade
#

my library has helpers that i can use universally between games

sharp lagoon
#

Ooh alright thank you

#

Is there any case where module is like needed?

bleak glade
proud idol
#

and to also update multiple scripts

sharp lagoon
# bleak glade not really

And are there times where using modules may ruin the game? For example let’s say you creating an npc and its attack function is the same and you have 3 diff types of npcs and you use module to store the attack function

bleak glade
#

i use my own framwork which isnt a "necessity" but so helpful

sharp lagoon
sharp lagoon
bleak glade
#

that object orientated for what youre pointing at not just a modukle

sharp lagoon
#

I didn’t understand my bad 😭

bleak glade
#

its fine

#

the module can use a constructor to make those 3 objects

sharp lagoon
#

Yoda Imagine you making a npc for attacking running, will you use module for its running and attacking functionality?

proud idol
sharp lagoon
proud idol
#

unless their attacks are unique, why not just write one attack function they can use form the module

bleak glade
sharp lagoon
#

I see

bleak glade
#

withtimeout and oncomplete are metafunctions that can be used for each constructed object created in new

sharp lagoon
#

Thank you both of you

vagrant jungle
#

can someone hire me 💔

high stream
sharp lagoon
#

Do you guys also put tables in modules?

proud idol
bleak glade
#

self is the first parameter for : functions

sharp lagoon
#

Ooh alright I think I get it a bit now

#

Also when making custom inventory for players it doesn’t need module right?

proud idol
#

depends how u code it

#

but i would prob use it

sharp lagoon
proud idol
bleak glade
proud idol
#

for functions that i need to call multiple times

sharp lagoon
#

Alright alright, I will try learning on Google about it more aswell, but thank you guys

#

I hope I didn’t bother with too many questions

sour yacht
#

nothing NEEDS modules, it just makes life like

frigid thorn
#

Can someone give me an idea on what to script : D

sour yacht
#

50x easier

radiant island
#
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage:WaitForChild("Events")
local SpellCast = Remotes:WaitForChild("SpellCast")

local Spells = {
    Motus = require(script.Parent.Parent.Runtime.Modules.Spells.MotusCast),
    Incendia = require(script.Parent.Parent.Runtime.Modules.Spells.IncendiaCast),
    ErroxFemus = require(script.Parent.Parent.Runtime.Modules.Spells.ErroxCast),
    Tornado = require(script.Parent.Parent.Runtime.Modules.Spells.TornadoCast),
    Strangutare = require(script.Parent.Parent.Runtime.Modules.Spells.ChokeMeDaddyCast)
}

SpellCast.OnServerEvent:Connect(function(player, spellName, ...)
    local spell = Spells[spellName]
    if spell and typeof(spell.Cast) == "function" then
        spell.Cast(player, ...)
    end
end)

is this good or na

somber vault
#

Anyone here over 3 years of scripting experience?

patent mirage
somber vault
#

.

blazing sparrow
blazing sparrow
high stream
#

u paying?

blazing sparrow
#

what ur price

celest zinc
high stream
patent mirage
high stream
celest zinc
patent mirage
celest zinc
patent mirage
celest zinc
patent mirage
patent mirage
celest zinc
#

investments

high stream
#

tbh

sturdy mango
#

can someone help the tool is not going into the player's backpack

#
local Context = game:GetService('ContextActionService')
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Hum = Char.Humanoid

local Tool = Instance.new('Tool')
local Handle = Instance.new('Part', Tool)
Handle.Name = 'Handle'
Tool.Name = 'Test'
Tool.Parent = game.Players.LocalPlayer:WaitForChild('BackPack')

high stream
#

change

#

:WaitForChild("Backpack")

#

the p should be common

#

in backpack

sturdy mango
#

oh so like lower rcase?

high stream
#

yea

sturdy mango
#

lower case

#

oh ok ima test

sturdy mango
high stream
#

np

rugged mist
#

yo

sharp lagoon
# high stream np

Abyss, when making an egg hatch for example in game do they animate it by script or manual?

high stream
somber vault
#

ah yes modularisationa maake me moan

vestal pumice
somber vault
vestal pumice
#

no theres so many modules

somber vault
safe sail
#

lf scripter who can do combat system, scripting animations and VFX etc dm for more info (small- medium) tasks.

plucky talon
#

anyone know how to make it so if u buy a gamepass it makes the player equip a hat?

glad ivy
#

Any good programmers here?

rugged mist
rugged mist
plucky talon
#

can someone PLEASE help with this. i want to make a hat gamepass that if u buy it the player equips a hat. im not sure how to do this please help

#

pleasee brooo

blissful wharf
#

yo im project manager for a group with me and my mates, currently building a team to make a gang beasts inspired game with the goal to spend no money, if anyones down to code the game with me (bring as many mates as u want but u will be splitting the % between u). The payment will be commision once the game has released

somber vault
#

dSGZORNG
I HATE

#

CODING

#

WHYAMIDOINGTHIS

#

I AM JUST A CHILD I SHOULD BE GOING OUTSIDE

#

I FUCKING HATE THIS

#

😭😭

#

IDG

#

I FUCKING HATE EVERY ONE

#

KFJGZJFGN

#

FGZDFGFDHDGDG

somber bridge
#

What the freak

willow vapor
#

Can anyone fix a small bug in my game, I’m able to pay

vestal pumice
#

or show the issue

#

most people here will help fix the bug for free if you jsut show it

rotund pawn
young mirage
#

Is there any plugin that helps autoattach a player to a alignorientation / alignposition in a part

short nacelle
#

anyone know how to fix this

young mirage
#

i want my player to move with the part but lowkey theres like 0 script help tutorials or anything i can find in a forum that helps with sticking a player to an object

rotund pawn
#

Also selected doesnt exist in that function(?)

short nacelle
rotund pawn
#

What is selected supposed to be?

short nacelle
#

the guistate

#

like this?

civic garnet
#

go learn the basics first

short nacelle
rotund pawn
#

if (I asume )Value.GuiState.Selected == Enum.. and Sounds.ButtonSfx.IsPlaying then

short nacelle
rotund pawn
#

if condition and condition then
--code
end

modest pecan
#

wait I didn't put the code

jaunty moon
vernal pawn
#

idk lol

timber maple
#

anyone know how to make the awakening bar fill up? like how to set it up and make a topbar with a characters dropdown, shop, settings and emotes

modest pecan
#

what is the best line of code in the entire world?

lapis idol
timber maple
#

can anyone recommed a tutorial for the topbar v3 plus?

modest pecan
lapis idol
modest pecan
#

game:Destroy()

lapis idol
modest pecan
#

print(“Bye World :(”)
game:Destroy()

timber maple
#

can anyone recommed a tutorial for the topbar v3 plus?

next escarp
#
local Color = game.Workspace:WaitForChild("color")
local touched = false

Color.Touched:Connect(function(otherPart)
    if not touched then
        touched = true
        print(otherPart.Name .. " touched the part!")
        task.wait(1)
        touched = false
    end
end)

It's giving error attempt to index nil with 'Touched' 😦

inland hemlock
#

hey, can i apply attributes to players ?

fiery valve
#

does anyone know where can i find free assets to use since im learning and i dont want to see see stuff that ugly for now

runic quarry
#

No scripting required

fiery valve
runic quarry
#

Oh I don't

#

Mb

#

Can check out Roblox marketplace maybe

fiery valve
#

alr thx

somber vault
#

Anyone here scripter . modeler or animator?

remote bear
#

yes it would work, you just need to make a client side script to send the message and in the sever display what you said with billboard guis, but yo may want to make a filter for it

timber maple
#

can anyone recommed a tutorial for the topbar v3 plus?

rotund pawn
#

Any tips how to start with scripting Grind building system? Basically how to limit movement by studs (grid) and get position of mouse in 3D

hardy pilot
#

Yes

#

You have to disable bubblechat and then use text chat service on the client

next escarp
#
local testPart = game.Workspace:WaitForChild("testPart")
local touched = false

local function changeColor()
  testPart.BrickColor = BrickColor.New("Toothpaste")
  task.wait(1)
  testPart:BrickColor = BrickColor.New("Medium stone grey")
end

testPart.Touched:Connect(function()
  if not touched then
    touched = true
    changeColor()
    task.wait(2)
    touched = false
  end
end)

It's not working 😦

late sapphire
next escarp
late sapphire
#

try printing "touched"

#

to see if it actually touches

next escarp
#

Ok

sleek pasture
#

is it possible to restrict mouse movement within a specific radius on the screen?

#

or would i have to create a custom mouse for something like this

late sapphire
sleek pasture
#

hold on

#

so there's the screen, which normally your mouse can't move beyond, but it doesn't get locked when it reaches the edge, which is exactly what i wanna do with the mouse in the radius

#

i can just set a central rotation point for what i wanna do, but then if i move my mouse too far one direction and keep moving the cursor in a circular motion, it obviously stops working the way i want it to

#

because of that actually, i kinda want the mouse to only be able to follow that circular line

late sapphire
rotund pawn
#

Can't you just check if mouse position gets outsize Y X of that area, force its position to border?

gilded depot
#

just bought violet valk, w or l purchase?

hardy pilot
#

💔

gilded depot
hardy pilot
gilded depot
#

atleast i look dog ass rich now

#

korblox and valk can pick up some baddies

#

🔥

solid olive
#

lol right it will look even better if u buy headles

astral crypt
#

lowkey goated

sleek pasture
tiny obsidian
#

u just gave away your game idea

#

💀

#

also add a option to go back

#

for the previous prompt

#

not only next

astral crypt
#

😭

tiny obsidian
#

oki dokie

astral crypt
#

BUT U LOWK SCARING ME SO GOOD IDEA

tiny obsidian
#

wa

#

chill

#

thats a simple idea that every game has 😭

#

nothing big

astral crypt
#

i thought its fine bc its a short tut and you can spam next

tiny obsidian
#

thats 1 case of players

#

u gotta account for all types of people

astral crypt
#

yeah true, thanks i'll add that

tiny obsidian
#

oki dokie

#

its no harm too so youre fine

#

afk

limpid shale
#

my script works but there errors like in the leaderstats that lead to freezing the game (not from my pc)

sour trellis
rocky lintel
spring beacon
#

Naruto puzumaki

clear forge
lean ocean
#

yea cause u didnt put a task.wait() in the while loop

#

@limpid shale

lean ocean
#

also this is pointless

limpid shale
#

I solved it

tardy pasture
magic yacht
#

does anyone actually like the new explorer ui

magic yacht
#

i dont blame him hes a begginer

delicate cedar
#

any suggestions for scriptinh tutorials

#

i am waching this currently:

silver verge
quartz scarab
#

someone can leran me lua?

tardy pasture
wispy bane
#

when you do inventory systems, for weapons that have unique qualities (like an enchant or modifier) but also items that can be acquired at high amounts without modifications (for example, potions or resources), should they be stored in arrays or dictionaries, or should I use a hybrid system for this?

wispy bane
fossil spear
#

local weapons = {['Norma'] = {Enchants = {}, Quantity = 0}} etc

#

ofc u can do table.insert but im not gonna write it all

tardy pasture
wispy bane
fossil spear
#

ya

wispy bane
#

I see, interesting

fossil spear
#

or u can do an event called Add Item and then local Inventory = Decode(Data.Inventory.Value); -- json

if Inventory[ItemName] then
    Inventory[ItemName].Amount += Amount;
else
    Inventory[ItemName] = {
        Item = ItemName;
        Amount = Amount
    };
end

then set the new value to Encode(Inventory)

deep solar
#

Your problem is the boundaries. Take a base price of 2000, you buy a land with this price so the new price is 2000 * 1.2. However the price is now greater than 2000 so the reverse multiplier 1.05. This makes the sell price 2000 * 1.2 / 1.5. So the user makes a profit of 2000 * 1.2 / 1.05 - 2000 ~= 286.

If you want to account for this you need to check the previous adjustment when doing a reverse. Check if dividing the multiplier of that adjustment lands you in range of it, if thats the case then use that multiple to reverse instead.

For example with 2000 * 1.2 you would use the second adjustment normally, which means you check the previous adjustment first by dividing 1.2, 2000 * 1.2 / 1.2 = 2000 <= 2000, thus use the first adjustment to reverse instead.

#

Ideally you would use a function that takes the number of land as input and manipulates that to return a price rather than a recursive one.

Then you can reverse with the price of #land - 1

formal acorn
#

hey guys, i started learning how to script like 6 months ago, its going really well but now im confused. I can make many cool things but im not that good to make some more complex stuff like whole egg system etc. what should i do now?

tardy pasture
fossil spear
#

why do people make simulators when they start scripting

tardy pasture
fossil spear
#

simulators are like the hardest shit to make, rpg games are the easiest unless we talking about easy sims

formal acorn
formal acorn
tardy pasture
tardy pasture
formal acorn
fossil spear
#

maybe a sim that has nothing in it

tardy pasture
tardy pasture
fossil spear
#

a good sim takes a shit ton with the framework and everything else

tardy pasture
fossil spear
#

anime champions simulator

#

shit is like the hardest sim ik to recreate

tardy pasture
#

never heard of it

formal acorn
tardy pasture
formal acorn
#

especially in roblox

formal acorn
# tardy pasture send ss

btw crimson what should i make for my portfolio cuz i have no idea, i just made 2 things that are pretty simple for my youtube

tardy pasture
#

the more u make the more u can put it

fossil spear
#

its not even that its hard, its just that it takes a SHIT TON OF TIME to make, cover all the systems, make sure there arent any bugs, and they did it insane, and the math in there is very hard to make too

formal acorn
tardy pasture
fossil spear
#

^ not true btw

tardy pasture
#

it is lol

fossil spear
#

unless u code for a 3year old then no

tardy pasture
formal acorn
fossil spear
#

ya but they have basic understanding of how a script should look

tardy pasture
#

lol no

fossil spear
#

yes

tardy pasture
#

nope

#

believe me

tardy pasture
#

all they want is it is ez to either add stuff to it things like that

#

and it has to work good in game

formal acorn
#

i only made inv save system with custom item saving and codes system

fossil spear
#

dont listen to him, when u start getting hired by people who have experience they will not hire u anymore if they dont like how u organize

tardy pasture
#

i never said u dont have to organize ur script

#

i do it for readability

formal acorn
fossil spear
#

CrimsonVH — 5:23 PM
fun fact most hirers arent coders so they dont care about how it is scripted they just wanna see the function of it

formal acorn
#

thats what i think

fossil spear
#

listen im not gonna argue anymore please dont listen to him

tardy pasture
#

if they could code themselve why the hell would u hire someone

formal acorn
#

then tell me

#

what should i do

tardy pasture
#

do what u think is best for u

formal acorn
#

yall/you have way more experience than me and went through allat

tardy pasture
fossil spear
#

learn how to organize, please type in either camelCase or PascalCase, keep things in check dont try to go for the easy way to make a script because its bad practice

#

and thats the way u make ur game have 30 bugs

tardy pasture
#

oh yea no i agree on this

formal acorn
#

so uhmm

somber vault
karmic coral
#

Lf smone to make inventory ill pay 700 robux

next escarp
#
local testPart = game.Workspace:WaitForChild("testPart")
local touched = false

local function changeColor()
  testPart.BrickColor = BrickColor.New("Toothpaste")
  task.wait(1)
  testPart:BrickColor = BrickColor.New("Medium stone grey")
end

testPart.Touched:Connect(function()
  if not touched then
    touched = true
    changeColor()
    task.wait(2)
    touched = false
  end
end)

It's not working 😦

lapis idol
#

nvm im dumb lol

midnight hull
#

testpart:BrickColor

#

please use Script Analysis

lapis idol
#

doesnt it highlight the errors even without script analysis

midnight hull
#

yeah only if you run it it outputs errors in output

lapis idol
#

i remember it would've highlighted the : with red line underneath it

#

how did bro not notice the long red line

midnight hull
#

oh yeah

willow timber
blissful sparrow
#

can someone help me make a game in roblox (i will give 35% of the entire earnings of the game) i am looking for someone with experience to work on GUI and script

vast cave
#

what is the error here

elfin karma
#

can someone help me with a proximity UI thing

#

(say yes)

bleak glade
sharp lagoon
#

@bleak glade Yoda when making for example pet inventory is it better to script the folder where pets will be or a manual folder?

bleak glade
#

the actual pets or where theyre stored

rugged mist
#

I’m tripping

bleak glade
#

fr

#

you can use semicolons

mint minnow
#

i need someones help please

#

my animation doesnt play even tho its set to action

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildWhichIsA("Animator") or Instance.new("Animator", humanoid)

local holderModel = ReplicatedStorage:WaitForChild("HolderAL"):Clone()
holderModel.Parent = character

for _, part in pairs(holderModel:GetDescendants()) do
if part:IsA("BasePart") then
part.Anchored = false
end
end

local cube = holderModel:WaitForChild("Cube")
local leftHand = character:WaitForChild("LeftHand")

local motor = Instance.new("Motor6D")
motor.Name = "HolderMotor"
motor.Part0 = leftHand
motor.Part1 = cube
motor.C0 = CFrame.new(0, 0, 0) -- adjust position if needed
motor.C1 = CFrame.new(0, 0, 0)
motor.Parent = leftHand

local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://86365348603778"

local track = humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = true
track:Play()

print(" Animation playing using Motor6D")

karmic coral
#

paying 2k robux for someone to recode my game its a simple game ngl

dark coral
sharp lagoon
lost oasis
#

How do I make a part move up and down

hasty oak
lost oasis
winter girder
#

What's the difference between Remote Events & Remote Functions?

hasty oak
#

Remote functions are 2 way

bleak glade
remote yarrow
#

guys i have my code here but i talk to the npc my name and avatar pops up but no the npc one but i cant manage to delete my avatar in this script what and where do i delete?

sour yacht
remote yarrow
#

this is the code

static coral
#

how does one go about making a projectile system with dynamic physics like the one that diddy forces has where you can lead your shots and colliding with the projectile while its still moving will damage you

remote yarrow
sour yacht
remote yarrow
sour yacht
#

DURRRRR

static coral
sour yacht
#

21

bleak glade
sour yacht
#

ya sure in a bit

remote yarrow
#

the script

#

it does this now

sour yacht
#

its

#

the viewport frame

#

ur not modifying it at all

remote yarrow
#

If i change line 3 would be the Rig pop up then?

#

line 2 i mean

quartz scarab
weak radish
#

Since when can I store tables in datastores?...