#code-discussion
1 messages Β· Page 91 of 1
Raycasts are pretty easy
does anyone have a script to scale all UiStrokes through all devices?
you're smarter than I thought lol
Yes because I don't finish my project
Doesn't meen I cant code something
coding is easy
Bro I like your project keep up the good work
I can code anything and if you cant then I'm def better than you
don't argue over something small and dumb
It's called modesty
I wasn't bragging though..
I said I can code anything I put my mind to
it's different
he was asking me a question
How many years do you have
I was 13 and now 25
so 12
Become a Kingdom Rushers Pro in just 31 seconds
Game Link: https://www.roblox.com/games/6376585200/Kingdom-Rushers-Technical-Alpha?refPageId=40744336-a95b-499d-9aaf-fd2210789ef2
Coded this game right here
Can someone help me?
I have a button which checks if a player is ready, at the beginning it's 0/2 but then once one of the players in a team presses it, its going to show up as 1/2 for the other player, so when he presses it, its 2/2 and a certain function runs
I just dont know how to display local UI changes for that specific player
I remember when I was testing my game in studio, and when I clicked "play" all my game broke, the console had like 8 errors, also with "404" error
I tried and tried and always I tried to test it, the same errors
I said, well I will reset studio, then I closed it, opened it, and when I open, boom, my account wasnt logged in
Then I went to roblox web site, and BOOM account banned :/
So, if u are banned and still can play, all the game breaks
why did u get banned ?
if u don't mind to say why
uhm u can make int value which u can use it to check how many players
Making team menu
I put image of a team (image took in roblox without edition)
And roblox said "Nope"
And banned me
I appealed and they unbanned me, but Roblox moderation is still bad
the same thing happend to one of my friends
and it's not bad image or smth of that
it's normal image
It was an avatar with a wood background
sometimes roblox do stupid things
Ban exploiters: βοΈ
Ban people making games and that generate free money to roblox: β
οΈ
liking what you do obviously
working on redoing our script connections for our hitbox
I played this game
is profilestore the meta for data stores?
I got it set up and working for a test value but Iβm tryna make sure I should use it
I know type soul and dead rails use it
Why is everyone here so smart
Oh cool have a friend that works with u
weβre not
early type soul in 2023 first ever release had data problems so idk
I am the only scripter in my entire Studio, I have to do ALL
might just be how it was for them
well
smart minds think alike
that's why we are all here talking,cause we all thought to talk here
type soul used an out of date one
I finished a game in a week and Iβm selling it for 12.5k robux so keep up the good work ig
I feel the same, I just entered here and now I feel that these 3 years scripting are nothing compared to ONE single code of people from here
what's the game about
they used profileservice which was the predecessor to profilestore
Incremental Simulator
I think I have 4 years on this but still feeling like the people from here are tryhards in LUAU
the only simulators that are successful are the ones that follow trends
if your simulator doesn't (which I can tell by the name) then I doubt it would be successful
donβt most simulators literally use reuse assets and code
this kinda follows one, I and I already sold it so ig Iβm fine
yeah
this is a scam bro π
π
no, just your assets
@crude glacier
I write to you look dm
Y'all think this is ok from 3 weeks of learning scripting
uhh idk
can someone rate my statemachine, its my first one i made
export type StateHandler = {
onEnter: ((previousState : string?) -> ())?,
onExit: ((nextState : string?) -> ())?,
onUpdate: ((dt: number) -> (string?))?
}
export type StateMap = {
[string]: StateHandler
}
export type StateMachine = {
start: (initialState: string) -> (),
update: (dt: number) -> (),
transition: (newState: string) -> (),
getState: () -> string,
}
local function createStateMachine(states: StateMap): StateMachine
local currentState: string = ""
local initialized = false
local function transition(newState: string)
assert(states[newState], `State "{newState}" not defined`)
if currentState ~= "" and currentState ~= newState then
local exitHandler = states[currentState].onExit
if exitHandler then exitHandler(newState) end
end
local previousState = currentState
currentState = newState
local enterHandler = states[newState].onEnter
if enterHandler then enterHandler(previousState) end
end
local function update(dt: number)
if not initialized then return end
local handler = states[currentState]
if handler and handler.onUpdate then
local nextState = handler.onUpdate(dt)
if nextState and nextState ~= currentState then
transition(nextState)
end
end
end
local function start(initialState: string)
assert(states[initialState], `Initial state "{initialState}" not defined`)
initialized = true
transition(initialState)
end
local function getState()
return currentState
end
return {
start = start,
update = update,
transition = transition,
getState = getState,
}
end
return createStateMachine
i just want a rating on it and possible things i could improve about it
what's a state machine sir
how can I create my own "WaitToFinished" function, roblox's version is not as smart as I need it to be.
I tried to call the "MoveTo" and then I did a while loop that waits until a certain specific, but it seems calling a while loop after the moveto like.. fully stops the moveto, so what else can I do
well they are often called finite-state machines, its just simple architectural patterns of code that behave differantly depending on its state
finite* 
do u define states and code for those states, so like in a idle state an npc could be wondering and looking for players, then when it finds a player it will enter a persuit state where it will try follow the player
yeah π, i just made a typo
how do i make a portfolio?
can U make that understandable for someone that just finished learning loops,break and continue ππ
pretty much you just connect different "functions"/"events" and continue to the next one depending on circumstances (i think??)
ohhh
that's more understandable thanks
whats the difference between cframe and vector3
CFrame includes orientation and position, Vector3 is for just position
Ahh that thing
Dam
What game are you making
Looks cool
Roblox is saying continue instillation without flag settings when I try to download it how do I fix I removed bloxstrap Alr
How do I return the PurchaseDecision back to the PromptProductPurchase on the local side?
no
cframe includes postion, orientation and matrixes
vector3 can be postion or rotation
what the fuck
ignore my driving skills but would u guys say this car/drifting system is hard to replicate
like the whole system. the car, the drifting, the steering wheel anim
don't let this guy get a license
too late
Not too hard seeing it doesn't base the angular velocity on the speed of the vehicle
could u do it
how can I create my own "WaitToFinished" function, roblox's version is not as smart as I need it to be.
I tried to call the "MoveTo" and then I did a while loop that waits until a certain specific, but it seems calling a while loop after the moveto like.. fully stops the moveto, so what else can I do
ill pay R$ to however teaches me how to make this animation work using a script
just play a animation?
yep
Does it have a humanoid?
life would be so much easier if you could merge tables like that...........
or at least if there was default table.merge() method
table.move
Does a module or a plugin that trains RL based AI agents with basic Q Learning exist yet
yo does anyone know how i can save tools with their own attributes and different properties into a ds?
any open source resources i can use to convert tool into saveable data?
very cool
but why is so much data on recv
Hes jerking the drill π
π‘
do you want to wait untill the MoveTo finishes?
its not mine, its from another game i was just asking if that system is hard to replicate
pretty much i want to either wait for that, or break the function when it takes too long
so i was doing a while loop, checking how far they were from the waypoint, continuing to the next point if it gets close enough, or hreaking it if time was over 1.5 seconds (its a fast moving entity, so 1.5 is plenty)
but it just stopped the moving entirely
for some reason
if it's moving on flat ground, you could wait distance/speed
how would i get the distance of each waypoint
(waypoint.Position - hrp.Position).Magnitude
yeah i realized after i said that
hmm
but still... waiting isnt necessarily the issue
its cancelling the wait
i was thinking about that
but that would work the same as a while BLANK loop
and apparently stop it from moving
how are you stopping it?
just breaking the loop
the moveto is in the loop?
no breaking the while loop
ik. but is the moveto in the loop as well?
or well, i might have just returned the entire function
ehh somewhat yes
the whole thing
is like
in a loop
what's the code?
can i dm you
why?
ill have to explain some functions
and if it need more context, ill ask
local function getClosestPlayer(angel)
local bestPlayer = nil
local smallestDist = math.huge
for _, player in ipairs(Players:GetPlayers()) do
if not watchingManager.isPlayerDead(player) then
local dist = player:DistanceFromCharacter(angel:GetPivot().Position)
if dist < smallestDist then
smallestDist = dist
bestPlayer = player
end
end
end
return bestPlayer.Character
end
local function move(player, angel)
local angelHRP = angel.HumanoidRootPart
local angelHumanoid = angel.Humanoid
local hrp = player.HumanoidRootPart
-- == Functionality == --
local pathParams = {
AgentRadius = 2,
AgentHeight = 5,
AgentCanJump = false,
AgentMaxSlope = 45,
}
local path = PathfindingService:CreatePath(pathParams)
path:ComputeAsync(angelHRP.Position, hrp.Position)
if path.Status ~= Enum.PathStatus.Success then
return
end
local waypoints = path:GetWaypoints()
for _, waypoint in waypoints do
if watchingManager.shouldAngelMoveYet(angel) and (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then
angel.Humanoid:MoveTo(angelHRP.Position)
return
end
angelHumanoid:MoveTo(waypoint.Position)
local startTime = tick()
while task.wait(0.05) do
print("repeated")
if watchingManager.shouldAngelMoveYet(angel) and (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then
angel.Humanoid:MoveTo(angelHRP.Position)
return
end
if (tick() - startTime > 1.5) or ((angelHRP.Position - waypoint.Position).Magnitude < 1) then
break
end
end
end
end
-- == Main Loop == --
for _, angel in CollectionService:GetTagged("Angel") do
task.spawn(function()
while task.wait() do
if not watchingManager.shouldAngelMoveYet(angel) then continue end
if (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then continue end
local player = getClosestPlayer(angel)
if player then
move(player, angel)
end
task.wait(0.2)
end
end)
end
its a weeping angel
most of the function names are self explanatory
the part is at angelHumanoid:MoveTo(waypoint.Position)
below it is what i tried to do
to make my own wait to finished
what's watchingManager?
its a module script
ok i had a feeling
any clue how to help π this whole thing has made me stop working on the game
when exactly does the problem happen? like when the angel is moving then someone looks at it? or when just someone looks at it no matter what state the angel is in?
it happens super randomly when every player looks away
when its supposed to fully move
no restrictions
what does watchingManager.shouldAngelMoveYet() check for?
its pretty much just a true value
its if you have looked at angel already, set to true
i dont get it. what exactly is it checking?
if its true
"watchingManager.shouldAngelMoveYet()" returns true
pretty much all the time
@ivory sparrow lua if path.Status ~= Enum.PathStatus.Success then return endi think it's this that's causing it. once you get the path and if the path isnt successful, there's nothing to change which player it's going to try to go to
when checking which player is the closest, you should check to see if the path to the player is successful as well
i think i get what you mean, but i dont want it to get unpredictable and not go to the closest player
you check if the last distance is less than the previous one (what you're already doing), then check to see if a path can be created to the player. if so, set the closest player to that player
also, you're setting smallestDist in getClosestPlayer() for no reason (it's never used)
its used as the biggest number
at first
which you right
i guess i could just take the first number
and set that as the smallest at the beginning
im still somewhat confused
(i suck at reading stuff and understanding π are you able to give a code example)
you basically do what you did here:```lua
local path = PathfindingService:CreatePath(pathParams)
path:ComputeAsync(angelHRP.Position, hrp.Position)
if path.Status ~= Enum.PathStatus.Success then
return
end```but in getClosestPlayer()
(after you check the distance)
yes
local currentKey : any = nil
local function callInstanceMethod(t, ...)
t.__instance[currentKey](t.__instance, ...)
end
local function returnMember(instance, key)
return instance[key]
end
return function(t, k)
local class = getmetatable(t)
if class[k] then return class[k] end
local success, member = pcall(returnMember, t.__instance, k)
if not success then return class end
if type(member) == 'function' then
currentKey = k
return callInstanceMethod
end
return t.__instance[k]
end
Instead of Class.__index = Class
You're doing Class.__index = thisFunction
Any way to optimize it? It's a way to extend roblox instances with your class, so Instance methods and your class working together.
Also you have to set self.__instance to Instance that should be extended when creating your class.
it's just another check within the loop
you could set it to a variable outside the function so you could use it in move() instead of having to calculate the path again
so im just moving where it calculates thepath? what would that do.. π
sorry that im not understanding
no. you would add that same check in getClosestPlayer()
you calculate the path in there as well to see if a path is possible
to that player, if that path isnt possible to that player, break the loop (or go to next closest)
ima have to add the angel into the function
so gimme a sec
can you give a syntax example on how you use it
i don't really follow what you are doing
sorry
forgot i already did
dont break it. check for the next player (if there is one)
im tired, its been a while since ive done this
alright
how can i make the base of the cylinder face up instead of to the side?
local cf = CFrame.new(-117.616, -280.4, 209.085)
local size = Vector3.new(5, 5, 5)
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.CanQuery = false
part.CanTouch = false
part.CFrame = cf
part.Size = size
part.Transparency = 0.75
part.Parent = workspace
part.Material = "Neon"
part.Shape = "Cylinder"
---------------------------------------------------------------------
while true do
local parts = workspace:GetPartBoundsInBox(cf, size)
local hitCharacters = {}
for i, part in pairs(parts) do
if part.Parent:FindFirstChildOfClass("Humanoid") and not table.find(hitCharacters, part.Parent) then
table.insert(hitCharacters, part.Parent)
end
end
task.wait()
end```
When creating class instead of usual Class.__index = Class you can set as this function and then when creating a new object you set
self.__instance = Instance <-- any instance that should be extended
Basically you have a Part, you extend this part with your class, so now you can use methods of this roblox instance and methods of your class too.
You are able to get child, properties, everything.
you basically do this:lua if dist < smallestDist and path.Status == Enum.PathStatus.Success then smallestDist = dist bestPlayer = player end
You merge your class with roblox instance
@lost pebble this is what ive done, its not clean, but ill fix it up
local function getClosestPlayer(angel)
local angelHRP = angel.HumanoidRootPart
local angelHumanoid = angel.Humanoid
local bestPlayer = nil
local smallestDist = math.huge
for _, player in ipairs(Players:GetPlayers()) do
if not watchingManager.isPlayerDead(player) then
local dist = player:DistanceFromCharacter(angel:GetPivot().Position)
if dist < smallestDist then
smallestDist = dist
bestPlayer = player
end
end
end
local hrp = bestPlayer.HumanoidRootPart
local path = PathfindingService:CreatePath(pathParams)
path:ComputeAsync(angelHRP.Position, hrp.Position)
if path.Status ~= Enum.PathStatus.Success then
repeat
local bestPlayer = nil
local smallestDist = math.huge
for _, player in ipairs(Players:GetPlayers()) do
if not watchingManager.isPlayerDead(player) then
local dist = player:DistanceFromCharacter(angel:GetPivot().Position)
if dist < smallestDist then
smallestDist = dist
bestPlayer = player
end
end
end
until
path.Status ~= Enum.PathStatus.Success
return bestPlayer
end
return bestPlayer
end
waiot
i forgot
to remove the player that didnt work... lol...
ugh
okay now im even more confused 
you're doing too much now
i bet i am π
there's no need to create another for loop when there already is one
local function getClosestPlayer(angel)
local angelHRP = angel.HumanoidRootPart
local angelHumanoid = angel.Humanoid
local bestPlayer = nil
local smallestDist = math.huge
for _, player in ipairs(Players:GetPlayers()) do
if not watchingManager.isPlayerDead(player) then
local dist = player:DistanceFromCharacter(angel:GetPivot().Position)
local hrp = player.Character.HumanoidRootPart
local path = PathfindingService:CreatePath(pathParams)
path:ComputeAsync(angelHRP.Position, hrp.Position)
if dist < smallestDist and path.Status == Enum.PathStatus.Success then
smallestDist = dist
bestPlayer = player
end
end
end
return bestPlayer.Character
end
oh now it makes more sense. the code looks fine
well the only downside (not really one) is would be using pcall to check whether its a property of the instance
exactly. i would change it from my original idea, though. check the distance then calculate and check the path so you're not making a new path for someone that's further
i believe theres some huge json data for each instances ane properties
true true... im going to test this first though, see if it fixes anything
and then ill optimize
but i reckon its not worth changing to it
mhm, im not sure if the json dump considered for that too
anyways i would say its pointless
roblox really needs to make stuff return nil when you're doing that
i remember some plugin called reclass use it
yes, its very inconvenient
found it, you are right it doesn't account for function only the properties
guys is it possible to make reference to a variable in another script
not directly
ModuleScripts exist for stuff like that
you could rely on modules
or on attributes on some cases, but i would say modules
can yall rate my repository and tell me what i should add/improve? https://github.com/gghalos/ggprojects/blob/main/datamodule.lua
Ig that data bout locked sessions is in another datastore?
Would be more reliable if it was inside the data itself
o
Not necessarily, as in my opinion it is generally safer in the case something happens in the other data, if something in the code is changed that depletes the datastore, you still have locked sessions that cant mess anything up further
Its also just for easy accessability and understanding, so you arent complicating the datastore
that's the only thing you added right?
yes
interesting
ok i have another problem, its not working anymore. im trying to fix the problem where it repeatedly goes up and down when standing on the button with a spatial query, and it is just not working
local tweenservice = game:GetService("TweenService")
local button = workspace:WaitForChild("buttonHitBox")
local debounce = false
-------------------------------------------------------------------
local tweeninfo1 = TweenInfo.new(0.1)
local goal1 = {
Position = Vector3.new(-117.616, -280.8, 209.085)
}
local tween1 = tweenservice:Create(button, tweeninfo1, goal1)
-------------------------------------------------------------------
local tweeninfo2 = TweenInfo.new(0.1)
local goal2 = {
Position = Vector3.new(-117.616, -280.4, 209.085)
}
local tween2 = tweenservice:Create(button, tweeninfo2, goal2)
-------------------------------------------------------------------
button.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and not debounce then
debounce = true
tween1:Play()
task.wait(0.5)
debounce = false
end
end)
button.TouchEnded:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and not debounce then
debounce = true
tween2:Play()
task.wait(0.5)
debounce = false
end
end)```
and annoying </3
im going to revert it and show you the actual issue that is requiring a fix anyways
this is a public module and repurposed to apply for the scripter role
Yo how to apply btw
We're a community of skilled creators. From programmers to graphic designers - we provide a platform to communicate, share, and transact amongst other fellow creators.
extensively read the application guidelines to ensure you dont mess up something basic and have to resubmit and wait even longer because you forgot you have to upload a script link not a image
@lost pebble
Alr ty
try it with just 1 and see if it breaks
1 angel or 1 player
angel
test the new code or try to get the old bug to happen
old bug
still happened
ok just making sure they're not interfering with each other
fair enough
if watchingManager.shouldAngelMoveYet(angel) and (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then
angel.Humanoid:MoveTo(angelHRP.Position)
return
end```try changing the return statement here in the while loop in `move()` to `break`
i believe i did have that at one point, but i shall try again
well now sometimes its doing that weird still moving thing even with the old code, gahh
ill look past it though
for now
no yeah they still do the weird glitch
ima try the new code changes
at this point, i would add print statement everywhere to see where it's failing
ive tried π its always at the move to finish
(where this whole discussion began
)
in the while loop?
in the move function
here
ill give example
for _, waypoint in waypoints do
if watchingManager.shouldAngelMoveYet(angel) and (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then
angel.Humanoid:MoveTo(angelHRP.Position)
break
end
angelHumanoid:MoveTo(waypoint.Position)
print("Moving")
local success = angelHumanoid.MoveToFinished:Wait()
print("Finished Moving")
if not success then
return
end
end
oop
it would freeze at the "print('moving')" part
so something is happening when waiting
so thats why i wanted to custom version
where it would just move to the next one if it took too long
(and then once they did their weird tick forward, it would print finished moving)
im gonna have to hire someone smarter than me to fix this π₯
aka give up bc im broke
so i would try:lua repeat task.wait() until (angel.Position - waypoint.Position).Magnitude < 1
while task.wait(0.05) do
print("repeated")
if watchingManager.shouldAngelMoveYet(angel) and (#watchingManager.PlayersWatchingAngel(angel) ~= 0) then
angel.Humanoid:MoveTo(angelHRP.Position)
return
end
if (tick() - startTime > 1.5) or ((angelHRP.Position - waypoint.Position).Magnitude < 1) then
break
end
end
this wasmy first version
but ill try that one
just cuz
yeah doing this makes them COMPLETELY stop moving
(for some reason.)
you put it after you called MoveTo(), right?
yup
try adding your other checks:lua repeat task.wait() until (angel.Position - waypoint.Position).Magnitude < 1 or not watchingManager.shouldAngelMoveYet(angel) or #watchingManager.PlayersWatchingAngel(angel) == 0
still not moving
i dont see how it just doesnt move now. try just adding task.wait(5) and see if it starts moving again
alright π
wait
what the
i think the code suddenly started working
hold
nevermind
they are moving, but its doing the weird teleport thing again
what teleport thing?
where they still move towards me even while looking at them
oh
so are you using this?
or just the task.wait(5)?
this
i realiuzed you said angel.Position
and not humanoidrootpart
so i changed that
wait
please tell you just had a great revelation
i mightve
in your original code that you sent
in the while loop inside of move()
the if statement boolean expression might be wrong. i think it should be this:lua if not watchingManager.shouldAngelMoveYet(angel) or #watchingManager.PlayersWatchingAngel(angel) == 0 then angel.Humanoid:MoveTo(angelHRP.Position) return end
nooo
you need it to move when people are looking
so when it doesnt equal 0
if it doesn't equal zero, then have it stop moving
i changed it. that was a mistake
o
LOL
alright lemme look
well its fine as is
shouldAngelMoveYet will never really be false
its just kinda there for optimization
to make sure its not tryna stop if its somehow not supposed to move
and then
#watchingManager.PlayersWatchingAngel(angel) ~= 0
so if more than 1 player is looking
stop moving
oh wait im stupid. yeah change it to ~=
so it wasnt a mistake
i just changed it into a mistake
does it work, though?
this is a struggle
hello
i would put print statements everywhere like i said with your original code that you sent
i already did :(
the freezing is at that area, and no other value changes from whats predicted
while task.wait(0.05) do
print("repeated")
local playersWatching = watchingManager.PlayersWatchingAngel(angel)
local shouldMove = watchingManager.shouldAngelMoveYet(angel)
if shouldMove and #playersWatching > 0 then
angel.Humanoid:MoveTo(angelHRP.Position)
break
end
local timeElapsed = tick() - startTime
local distanceToWaypoint = (angelHRP.Position - waypoint.Position).Magnitude
if timeElapsed > 1.5 or distanceToWaypoint < 1 then
break
end
end```
whats the point of the runservice-
am i missing something in the code
you might have to compute the path again bc the for loop is looping through waypoints based on a previous position of the hrp if the play has moved. so i think this bug happens when player moves away from the angel while not looking at it. so i think you should compute the path if there isn't a straight path to the player. if there is a straight path to the player, just call MoveTo(hrp.Position)
no. idk why he put runservice
π
Whats a parameter
a value passed into a function
can you explain more simplified
i was gonna use it
oh lol
just remove it
local function MyFunction(str) --We can access this value by giving a name to the parameter
print(str)
end
MyFunction("Hi") --Passing a string value into MyFunction```it's basically a function specific varaible
hey guys please if someone wants to work with me, pls lmk πβ im skilled, i surpass my limits, and im the eminece in the shadow, pls if u already got skill, and money, and dev experience, please lmk. thaank you.
wdym
do you not know how a function works?
I don't understand
I understand them
took me a year to understand them
but still
i dont think coding is for you bud ngl
breaks everything
they stop moving
ILL NEVER GIVE UP!
hey guys please if someone wants to work with me, pls lmk πβοΈ im skilled, i surpass my limits, and im the eminece in the shadow, pls if u already got skill, and money, and dev experience, please lmk. thaank you. I need to make money PLEASE, i got skill bro.
"parameter" is just the name given to values passed into the function. they're aka "arguments"
oh
alright, so draw a raycast to the position, if hits an object other than player, use pathfinding
also one more question
How do I know if it goes inside the end or outside the end
yeah you could try that. make sure you ignore other angels
that too
well, what if they collide with eachother π€
guess itll just push em LOL
if what goes inside/outside the end?
the code
?? Wdym
Like
Local fuction
"rehehehe"
end
Or
Local function
end
reheheh
this is jst a example
you put the code that you want to happen when you call the function in between the function definition (local function Example()) and the end
yea
the point of functions is to be able to have a block of code be done multiple times without having to rewrite all of it
yea
(there's also a readability aspect of it, but that's for later)
honestly readability is only important if you're gonna show your code to others
that might just be me
not really. it's nice coming back to old code and being able to read it faster and figure out what you wrote than having to read the specifics of what's going on
used to do that
like i have this 500 line code that i only really need to read 150 lines to know what's happening
you should probably set humanoid.MoveToPart instead of calling MoveTo() if there's a straight path to the player
whats the difference? (is the waypoint considered a part?)
you would set humanoid.MoveToPart to the player's hrp
Guys have you ever been in the stage where you can understand any code that you see but whenever it comes to writing your own code you have no idea what to do
How can someone get out of this stage
oh wait yeah
sorry, im being dumb
you're good
relearn coding
practice. make small stuff
Should a person in this stage learn more concepts, or practice with concepts he already knows?
practice with concepts you know. but you dont really get to choose which concepts you use when you think of something. so you'll most likely have a mix of the two. you use knowledge you've learned already and learn more as you're making it
Is luau coding hard work
just think of something that you think you can make with what you know. then if it doesnt work out, research
gooood
Modelling and building feel like great obstacles ngl
Also ui
watch maybe a toturial, and everytime you laern something ask ai to make you a challenge to do
then you are forced to recreate it
when i started i did that with killbricks and was so proud when it worked
Whenever i think of making something, i remember that i need models, animations, and ui to work with, all of which require learning
I think I'm in the tutorial hell stage
have you learnt important stuff like cframe and tweenservice yet
Yea
try relearning one by 1 and making your own challenges to do
Learnt as in basics right?
if anyone knows how to make a soccer system dm me frfr (if you hirable ofc)
Wait, if I were to make a inventory system that saves after rejoin, do I have to generate an ID for every ID instance/copy created?
So I can log them in DataStore?
And if so, how to prevent hackers from just pulling out the ID and effectively put the ID in their inventory so they own that item's copy.
Do I need to encrypt it ontop of turning item information into ID?
But then I'd have to deal with the key to decrypt and encrypt the key with a different key?
And is putting the encryption key on the server secure enough? Should I put the key on a web hosting website and use HTTPService to get key or smth? I am very confused.
Yes i learned by research research reaserch mostly devforum
== is checking somethings value is true i think
= means you are initializing something to some value
= is assign
== is compare (checking equality)
else is for any other case other than the original if statement
elseif is for another case other than the original if statement that fits this new if statement
yo would u say your a pro at scripting?
can u tutor me
nah. sorry
even with pay?
no sorry
alr
im currently helping someone with a game so it would be a mess managing between them
im definitely open for any help you need though
Way too convoluted ngl. Just let them do it if they do it, the only thing you really have to protect is the stuff people pay money for. Not everything needs NSA level security
Generally speaking, exploiters should not be able to inject items into their inventory because of server sanity checks
Alr so how do I fix this. Iβm trying to make a simple button game and Iβm copying the buttons but this happens. Someone help lmao
It means that the game couldn't really find the "player" you're trying to reference
Have you defined "player"?
can someone breka down difference between client and server i think i understand but i js want to make sure im 100% clear
Client is on your computer. Anything and everything on the client is like your stuff, no one else can see or manipulate it. The server is hosted by Roblox, it allows you to connect, and it runs all the server side logic
alright thanks thats basically what i thought
so server would be something like a 2x coin event and client would be your inventory
Well the server would still control what you have in your inventory
oh alright
Iβd suggest looking this up in the docs to really learn what the client and server are
i will ty
you are trying to access UIs aka the button things from server which is actually a client thing, client means the UI aka button only works on YOUR only pc
but you need to update the leaderstats in server, so you need to communicate with the remote signals, aka remote event or function
got it, so the chances of ppl back dooring rare items are pretty low.
you can access ui from server script (though unoptimized and fully wrong) for certain things if you need
I am a avid remote hater so I use server scripts on ui sometimes
you can still get click signals from them and stuff
least noticeable visual bug
Aye its looking great tho
R u planning on making a game out of it ?
anekakanekulo
There aint no way thats a real region lmao
HELP ofc not
I'm good at editing then
It is a pretty legit take on what a theoretical shutdown would look like
ikrrr
ill use this to prank some friends
Nice
so i made this code as to like spawn items, Coins for instance ina scertain area (Zone) everything works thankfully but now i noticed the coins sometimes spawn out of zone, any tips to help me with it? The blue zone is supposed to be zone\
local coinmodel = game.ReplicatedStorage:WaitForChild("Coin")
local coinzone=game.Workspace:WaitForChild("coinzone")
local Debris=game:GetService("Debris")
local playerserv=game:GetService("Players")
--Create Instances (leaderstats)
playerserv.PlayerAdded:Connect(function(plr)
local lbfolder=Instance.new("Folder")
lbfolder.Name="leaderstats"
lbfolder.Parent=plr
print("leaderstats created.")-- Confirmation
local coinint=Instance.new("IntValue")
coinint.Name="Coins"
coinint.Parent=lbfolder
print("Coin folder created")--Confirmation
coinint.Value=0
end)
local function spawncoin()
--Randomize the zone of spawn per coin
local offX,offY,offZ=coinzone.Size.X/2,coinzone.Size.Y/2,coinzone.Size.Z/2
local randX,randY,randZ= math.random(-offX,offX), math.random(-offY,offY), math.random(-offZ,offZ)
local newcoin=coinmodel:Clone()
newcoin.Position=coinzone.Position+Vector3.new(randX,randY,randZ)
newcoin.Anchored=true
newcoin.CanCollide=false
newcoin.Parent=coinzone
local cantouch=false
newcoin.Touched:Connect(function(otherpart)
if cantouch then return end
cantouch=true
local character = otherpart:FindFirstAncestorOfClass("Model")
if not character then return end
local humanoid=character:FindFirstChild("Humanoid")
if not humanoid then return end
local player=playerserv:GetPlayerFromCharacter(character)
if not player then return end
print("Touched by:",otherpart.Parent.Name)
if player and player.leaderstats and player.leaderstats.Coins then
player.leaderstats.Coins.Value+=1
newcoin:Destroy()
--task.wait(0.5)
--cantouch=false
end
end)
game.Debris:AddItem(newcoin,5)
end
while true do
task.wait(1)
spawncoin()
end
yo when you guys add module scripts, if it's related to a local script do you ever put it under the local script, or do you you store it under one module scripts folder
I would store it on replicatestorage
ok got it
thats what i did in the left screenshot
seems more organized
ok thx
Tbh I never saw a module inside localscript
same lmao
Up to preference
I use modules for everything I have one script that loads my lazy loader which loads all my modules
Lazy
Fr
Most the time is spent on api calls anyway
whats a lazy loader
Its a module loader but it only loads module when you need it
Its a loader but lazy
why dont you wanna load all of it
Its just to make ur the game run faster on startup
doesnt all of it load automatically
You need to require modules
ohh
Other than fetching data, all my code finishes in below a second
Typically I don't understand absolutely nothing about modules I still haven't reach my tutorail
What do u not get
All of it
Well why doesnt yours
Ive never experienced making code so intense it takes noticable time to load
I do know that it need to be called and it's just like easier to store things like tween and items do
A module is just a normal script but you can use the code you put in it in other scripts
Ik
It also helps to organize code
Yep
Uh idk i havent tested how long it takes
words of encouragement and disencouragement when you win or lose a match
why even an msg?
Just kick if they lose
I am looking for a scripter to develop the "unboxing simulator: Rebirth"
We have
LMAO
nah if the player loses 3 times they're getting perma banned from my game. no losers here
that's just 3 assets π keep working, you got this
Some people think scripters can do everything
fr
Just think these channels are for fun, a scripter can do it all
Guys do you think tick() and os.time are outdated?
there were only two of them in the original, and he flew 300 million visits, bruh
Bro just doesn't knowπ
I thought you were a scripter
Wdym they had other stuff like coins and pets
I'll be doing this soon, and I've made a location for the eggs
Yeah but with only 2 crates they're saying that there isn't much to work with which is true
Strangely, those who invented the real legend did not think about it
They had pets + coins I don't understand you
.
I say
why are some of them repeated
but do u have permission to revamp unboxing simulator
I add
No, but I don't think they'll mind
what does the word revamp means that everybody using it now ...
first portal
Better version, usually more graphics and a bit more functionality
Think of it as a mod or DLC
Can anyone please explain to me why this script doesn't work on the client:
local Workspace = game:GetService("Workspace")
local Parts = Workspace.Parts:GetChildren()
for index, Part in ipairs(Parts) do
print(index)
if index > 2 then
Part.CanCollide = false
print("Should've worked")
end
end
Feels like you used saveinstance() and just want smb to script for you
Does it print
Output
You don't waitforchild part, client didn't load them yet, your script isn't in StarterPlayerScripts
Do I have to wait for the child part?
Possible issues so far
If parts didn't load for client, ye
Ohhh, I thought the server took care of that.
You're using local script
I am, yes.
You must put it in StarterPlayerScripts first of all
It is in StarterPlayerScripts, but thank you for mentioning it.
But when I use WaitForChildren, on this line:
local Workspace = game:GetService("Workspace")
local Parts = Workspace.Parts:WaitForChildren() -- line 3
I get this error:
WaitForChildren is not a valid member of Folder "Workspace.Parts" - Client - LocalScript:3
Not a method
How did you come up with that
Are methods the ones that use colons?
Sure
You can't wait for multiple
Oh well, then I do know what to do.
in one method atleast
Thank you for the help Queln.
\ (^-^) /
Working on an advanced building system, how to handle colision between other builds?
Just check Hitbox and border collision?
Waow advanced
Is there a better way to do it than this way:
local Part = Workspace.Parts:WaitForChild("Part")
local Parts = Part.Parent:GetChildren()
Is it grid based?
aaaah alright thanks
Nope, builds have connectors, players choose which connector to build on
this should do
What is that
So just GetPartsInPart()?
I would create my own hitboxes to control it better
No, use the bounding box
i would do too, but no idea how his grid works
use what queln said
hey is ur pfp the og windows flower
I just started, so no idea. I just use it for bridges, so player clicks to end of bridge, chooses what type of build, it builds,
:3
we should kill ourselves β€οΈ
We?
yea

β€οΈ
who is smb
I'm trying to strive for the 2019 style, aren't I?
2d game where you drag and drop characters around, its mainly roleplay
i do not want to begin to image what "starterUi" would look like π₯
will be very difficult in roblox
i would personally not use roblox for it
I see yeah
Iβd probably have to pay shit tons to a scipter to script that kind of game
Would 200k fall too short? Probably
i mean, yeah
but it'll take a while and be very messy
True, yeah
your best bet would be smthn like what Gacha Online did
I just think the idea is exciting
Ehh thats also true but not very my style
Easiest way to store player builds in sandbox tycoon?
I mean i got the skill to draw the entire world
Id be very detailed work in coding omfg
how do i scam someone without them knowing guys!
Team create is always scam
this doesnr seem particularly hard to script π€
who the fuck uses team create? π
They are π
i dont think itd be much harder than the same thing in a diff engine
Itβd be hell to adjust it for both pc and mobile btw 
Mmmm yeah i wanna create a prototype
Would it be laggy?
not sure ive never had a ton of ui elements on the screen
i swear it's a dead feature bro, every aspect of dev now is "here's a limited file with only the section you're working on, fix it and send it me back pls thx!!!"
like you're never in the same place
Iβll try to make a prototype of the silly 2d game this week starting from today
I suppose itβd be fun
(I have no idea how to script)
Tho it means i can just make the assets
like maybe one character to customize and 2 rooms
Why workspace does not need game. prefit, but replicated storage does XD
workspace is a shortcut for game.Workspace
Yeah, but why they dont add shortcuts for the rest?
because its freq use
Workspace was never my freq. used π Its annoying
to avoid it js at the start of the script do lua local RepStore = game:GetService("ReplicatedStorage")
obv only use "GetService" if it's a local script
is there any difference between game.Replicated vs GetService?
if it's a server script js do game.ReplicatedStorage
GetService is used for local scripts
Never had any issues without using that
??? u can use GetService on server scripts aswell lmao
its good to define all your services at the top every script
with GetService
Never once used GetService with a server script
well u should be defining services at the top of your script anyways
some services u have to use GetService so its more consistent to just use getservice for every service besides workspace
for workspace u can just use workspace.
ive made myself a to do list, letβs hope i can actually make it this week
Can I just have module, that handles building of players bases, but it also has array, where it stores player data to save it?
just use profilestore tbf
No idea what that is
makes data saving and structuring alot easier
So it is datastore module template?
yeah
profilestore
its a module
u should look into it
βProfileStoreβ by loleris (Successor module to ProfileService) [GitHub repo] ProfileStore is a Roblox DataStore wrapper that streamlines auto-saving, session locking and a few other features for the game developer. ProfileStoreβs source code runs on a single ModuleScript. Read documentation here: ProfileStore wiki (Click me) Get the ...
literally every big game uses it
Cool, Ill try
Guys
Is it good if a new scripter relies on ai to create codes
Note: the code works perfectly
So is it bad in any way?
Big emphasis on "rely"
no not fully
cause ai uses depricated functions and leaves alot of mem leaks
well then how do you know the ai code is good?
is it possible to tween unions?
what property are u tryna tween
I'm in the stage of I can understand most scripts I see, but I forget everything when I try to write code myself
Maybe it's tutorial hell
Idk
π i learned how to code much lesser
local b = -2
local a = b > 0 and 3 or -1
is not that hard
you have to practice
focus ur scripting, but i suggest resting ur mind.
i spent coding for like 6 years on lua
actually is 4 years
bc the 2 years i learned how to modify code
Skid
Wdym
Unions are treated the same as all baseparts
guys can any one help me there is a problem when my timer restarts when i die
rotation
so i created a handle and put it into the stater pack, backpack i mean now whenever i click the tool for handle, my character gets stuck in the initial place where i first placed my handle, whats the move?
Unanchor handle
how does it restart?
I did that initially, also did it through script for making sure, still no help
that could also happen bc of its mass. make the parts of the tool massless
like it goes back to nothing and then when player thouches the part again the timer starts
what's the code?
guys help i need a script that gives u hdadmin mod commands when u touch a part, some suggestions about how can i code ts
for _,p in pairs(game.Players:GetPlayers()) do
script.Parent.SpeedrunTimerGUI:Clone().Parent=p.PlayerGui
end
script.Parent.SpeedrunTimerGUI.Parent=game.StarterGui
i dont see anything about touching a part and setting the timer. you're just setting the parent of cloned guis (which im confused on why since StarterGui already does that for you)
me when pairs
im a beginner and i js made this script where there is a movingpart and it chases you around and if you touch it you die, and if you click it, it despawns, but i dont kmow how to make the part clone every few seconds and that clone also chases you around.
have the script inside of ServerScriptService and have it loop through each part that chases you and do the logic that you made for it to chase you
i used ai
so where do i add the loop lmao
i wouldnt use ai to learn. i dont think it's an effective way to learn
whichever part has the part chase the player
i tried learnin i gave up
right
if you really want to, you wouldnt let any obstacle get in your way
wym
which ever part of the script that has the logic to chase the player
To the people who are already established scripters and are making thousands of robux: do you utilize AI alot?
there's more to it than just looping the chase logic since there's other logic with the player touching the part. so it's a little more complicated than that. but i want you to figure it out. i want you to learn enough to read the code and edit it yourself to make multiple parts chase you
aight ill try to find it
i dont fit this category, but i wouldnt if i was. i like to do things on my own
(btw dont expect to learn all you need overnight)
ofc
yee
I fail to understand this
Today I wanted to make a big system
I asked Ai and it literally gave me the script
I just had to tweak some small things
And there it was
there's an entire aspect to coding than just writing: problem solving. be able to solve (sometimes) complex things and see the outcome of those solutions is very rewarding
is it this
local function getNearestPlayerHumanoidRootPart()
local nearestPlayer = nil
local minDistance = math.huge -- Start with a very large distance
for _, player in ipairs(Players:GetPlayers()) do
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
local distance = (MovingPart.Position - player.Character.HumanoidRootPart.Position).Magnitude
if distance < minDistance then
minDistance = distance
nearestPlayer = player
end
end
end
if nearestPlayer then
return nearestPlayer.Character.HumanoidRootPart
else
return nil
end
end
no
oh.
that just returns the closest player
the function names usually tell you what it does
returns?
it's basically the output of a function that can then be used outside of the function
i see
you can see what it returns with the keyword return
local direction = (targetPosition - currentPosition).Unit -- .Unit normalizes the vector to length 1
so this code calculates
sum kind of position right?
a vector with a magnitude (size/length) of 1
based off of the positions of the target and the current part's position
more specifically, the direction from the part to the target
yes
how about this
RunService.Stepped:Connect(function(time, deltaTime)
local targetHumanoidRootPart = getNearestPlayerHumanoidRootPart()
no. but it's probably within that function
stepped is depricated btw
what
more so superseded
so it HAS to be this
if targetHumanoidRootPart then
local targetPosition = targetHumanoidRootPart.Position
local currentPosition = MovingPart.Position
if targetHumanoidRootPart then
local targetPosition = targetHumanoidRootPart.Position
local currentPosition = MovingPart.Position
the MovingPart to the player
local direction = (targetPosition - currentPosition).Unit -- .Unit normalizes the vector to length 1
local desiredVelocity = direction * MOVEMENT_SPEED
close to prevent jittering
local distance = (targetPosition - currentPosition).Magnitude
if distance < MIN_DISTANCE_TO_PLAYER then
desiredVelocity = desiredVelocity * (distance / MIN_DISTANCE_TO_PLAYER) -- Slow down as it gets closer
end
make one script that handles everything
thats what i did
clones the parts and moves it etc
now its confusing
yeah
but i want you see why and how though
dont use ai and it wont be confusing π
i want you to be able read it yourself and understand that this is where the movement happens
AI slop, you are not even trying to hide it anymore
he literally said he used ai
he legit said hes using ai
so its finding the position of the player and going towards it
he never tried to hide it in the first place
we are doomed
kinda. there's more to it
thats what i undertsoof other stuff is js confusing
send the full script
alr
and whats not working exactly?
i js want it to clone every few second nd chase me around
too long
so make a function to create a clone and cache the part then make a while loop that moves the parts towards the player
idk how to do allat
well i would recommend learning how to script before making something π
whats the point of using ai for everything when u cant even fix the bugs in it
or understand anything
like any good tut yk?
just read the documentation and devforum posts
where do i start
documentation
roblox uses luau so u read the luau documentation
A fast, small, safe, gradually typed embeddable scripting language derived from Lua
alr lemme read
yeah but u need to understand the luau syntax first
especially if u have no previous programming knowledge
thats skidding u aint gonna learn from that
i learned from it bro
if ur just copy and pasting code
alr thanks guys ill get learning
hope to see you making your own stuff soon
reworking whole rpg
is gonna take another 6 months π
but today, is not gonna be 6 months..
prob takes 1-3 months.
Can someone give me robux pls. Pls dm me
are there ways to get the default roblox materials?
Like as images that I can turn into a material variant, a 1 on 1 clone
Looking for one-task scripter ASAP (hiring post is being aproved)
@eager dagger
did someone call me?
I figured out that fuckin lookAt thing btw π€£
nice, how tho?
I had to use cframe.fromEulerAngesYXZ
I have 0 idea why I just guessed it
I think its because of how its oriented you have to use a different rotational order?
I looked at the fact that the X was controlling the Y and was like I wonder if this fucking function is used for that type of scenario and I guessed right
did that too, nothing
can anyone help me code that when i click the screen the gui hides
mousebutton1click
can anyone help?
anchored
its not
both yes
whats that inside it
Weld
did u weld it to the baseplate or something
i havent touched it
why is there a weld when its just one part
You do not need weld if its one part item
just delete it
u prob on the weld to surface feature thingy, disable it then remove the weld
ok it worked now, but what does Weld do?
Glue
hey, how do you make actual moon animator animations play in game
local part = script.Parent
local RunService = game:GetService("RunService")
-- Configuration
local axis = "Z" -- Change to "X", "Y", or "Z"
local rotationSpeed = 20 -- degrees per second
-- Axis lookup table
local axisRotation = {
X = function(angle) return CFrame.Angles(math.rad(angle), 0, 0) end,
Y = function(angle) return CFrame.Angles(0, math.rad(angle), 0) end,
Z = function(angle) return CFrame.Angles(0, 0, math.rad(angle)) end
}
RunService.Heartbeat:Connect(function(deltaTime)
local rotateFunc = axisRotation[axis]
if rotateFunc then
local rotation = rotateFunc(rotationSpeed * deltaTime)
part.CFrame = part.CFrame * rotation
else
warn("Invalid axis: " .. tostring(axis))
end
end)
How can i change this so if people stand on the object, they move with it
thx
how to obfuscate luau?
what?
js find obfuscator online
I hate mobile grammar auto correct
XD
is it better to obfuscate or encrypt?
its one tier lower than encryption interms of security I think.
@random nebula π
luraph
its impossible to run encrypted code
ur part in anchored
I mean they're pretty pointless anyway
Just don't have important code on the client in the first place
yup idk why he obfuscate
u need to obfuscate for client ac
it wasnt, it was wended
How to handle Saving of Building system, where each part build has 0-3 connector pieces, where players can build another building, nowhere else?
Use profile service
What does that have to do with it
I have to create some kind of structure that roblox can handle
theres no real good obfuscation that you can do on roblox
life if custom vms π
Obfuscating doesn't stop people from getting the code
it stops them from understanding it
it will make it way harder
ur client ac is only as strong as people not knowing ur detections
Not really there are tons of stuff to make them readable
very few people have access to them
not for luau?
if there is shit to reverse luraph those people get paid off
literally the owner of oracle is on payroll to not release his deobfuscator
synapse x didnt deobfuscate code
it let you obtain the bytecode and decompile it