Roblox Tycoon Scripting Tutorial
Вставка
- Опубліковано 1 жов 2024
- This series of videos will show you how to make a tycoon on Roblox in 2024, we will be going through everything you need to script in order to make a basic tycoon. More videos coming soon.
Part 2: • Roblox Tycoon Scriptin...
Get the project file by becoming a Channel Member: www.youtube.co...
Video for members on how to download project file: • How To Access Project ...
Discord: / discord
Twitter: / alvinblox
Roblox: www.roblox.com...
Thanks a lot to my Channel Members who have stuck with me since I have been away from making videos. They get every new episode released 24h before everyone else. Part 2: ua-cam.com/video/muULrxFFP4Y/v-deo.html
Cheers
yooo glad ur bacc
@@The_great_penguin yooooo, i agree
Welcome Back
YOURE WELCOME
Thanks for continuing to consistently teach the community new/updated things. Iv been watching your videos for a few years. As time has passed you become better at coding and teaching. Keep up the good work!
Since i am a programmer i figured the second part, even if you know he language the roblox functions are still something to learn. Well thanks for the tutorial.
game.Players.PlayerRemoving:Connect(function(player)
for _, plot in Plots:GetChildren() do
if plot:GetAttribute("owner") == player.UserId then
plot:SetAttribute("taken", nil)
plot:SetAttribute("owner", nil)
end
end
end)
local plots = game.Workspace.Plots
game.Players.PlayerAdded:Connect(function(plr)
for _, v in plots:GetChildren() do
if v:GetAttribute("Taken") == nil and v:GetAttribute("Owner") == nil then
v:SetAttribute("Taken", true)
v:SetAttribute("Owner", plr.UserId)
print("Plot given to "..plr.Name)
break
elseif not v:GetAttribute("Taken") and not v:GetAttribute("Owner") then
v:SetAttribute("Taken", true)
v:SetAttribute("Owner", plr.UserId)
print("Plot given to "..plr.Name)
break
end
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
for _, v in plots:GetChildren() do
if not v:GetAttribute("Owner") then continue end
-- plot is owned if it continues down here.
if v:GetAttribute("Owner") == plr.UserId then
v:GetAttribute("Plot", nil)
v:GetAttribute("Owner", nil)
print("Plot removed successfully for "..plr.Name)
end
end
end)
what does this do
@@m1rtillethis is the script
ty bc his script didnt work but urs did tysm
What the v in your code?😅
I continue to have a erro when it comes to for _, plot in plots:GetChildren() do can someone tell me what i do wrong in that code line
Here is my error:
Serverscriptsevice.plot handleiding:25: expected ')' (to close '(' at line 23) got 'for'
For the people having problems try moving the Plots folder directly under workspace tab rather than within another folder. Had problems for a while but that fixed it instantly for me
For me when I hit start none of the plots have the two attributes, any idea what’s happening?
same issue here
Is there a way to make it so that u are able to pick which plot u want instead of it picking for you?
yes u can
Hi Alvin, great to see you back!
Hi
How can I make it so that it puts you in a team when you claim your tycoon? Like each base has its own team
Lemme know if you find out
Alvin? What do I do if it doesn't say "taken" when I go to view the attributes?
This is the same for me. Does it still work?
@@thatonetrashduo7622 Just tried it, still works, make sure you look at all the plots in the folder
Maybe You arent looking the correct plot properties
It Did Not Work For Me 😢
Somehow
Smae😢
Thats because you have to shift to make it work.
This tutorial series saved my game and my will to make it! Thank you for making it!
I tried following another tutorial, but nothing worked and the stuff that did left me confused on why they did. You actually explained everything and did it well! Looking forward to making my first game and making it how I imagined without having to use shortcuts and being confused all the time
hey alvin, so when i check the attributes, nothing shows up
I did everything right (I think) and at the end for me there are no attributes? What do I do now
Yeah same
same problem lmk if u find out
i also have that problem
@@govar-zk7gv erase the "
@@ANURVM bro which one ' or "
I did everything Same but it was not showing any attributes
same for me
same
ik it might be a bit late but its not setting any attributes for some reason
sammmmeee
Same
How did you learn scripting
FLIP YOU ALVIN, I tried this and copied everything you wrote down and your code didn’t work at all. You wasted 30 minutes of my life. Flip you.
same, its like that for all his videos. I copy the script exactly how he puts it and it still doesnt work
Mb but when I type in "player.UserId" it does not turn blue why? Am I doing something wrong?
It says no attributes added yet
pls make a working tutorial
hey i have a problem and no matter what ive done i cant fix it when i press the test play it says "player is not a valid member of datamodel "game"........ can anyone help me with this ?
Have you found a solution? I'm dealing with the same problem
Theres smth wrong with mine but i secured it through alot of stuff wich is weird
It wont say Taken on the Attrtibutes could someone help?
Great Turtorial can you make a Turtorial for coding in creative 2.0?
I can’t believe I wasted my time on this, it didn’t even work, it just gave me a bunch of errors with the script.
It worked for me just look at the errors and copy the exact code line for line.
Mabye rewatch the totorial
You can’t watch this video without pausing lol
fr
Hey bro love your vids but in this vid I copied code but it's not working for some reason any chance you could reach out to me? Also you just gained a sub 😊
Never mind I fixed it 😅 but yet again THANKS SO MUCH
pls share it
@@TWITCH_CALLISTER
I subbed and still can’t watch part 2
game.Players.PlayerAdded:Connect(function(player)
-- Listen for when the player's character spawns (either initially or after death)
player.CharacterAdded:Connect(function(character)
-- Get the player's saved stage from the leaderboard
local stage = player.leaderstats.Stage.Value
-- Find the corresponding checkpoint part for the player's stage
local spawnLocation = workspace:FindFirstChild("Checkpoint" .. stage)
-- If the checkpoint exists, move the player to its position
if spawnLocation then
-- Move the character to the checkpoint
character:MoveTo(spawnLocation.Position)
end
end)
end)
YOU SOUND SO WEIRD WHAT
where that scribble line on my keyboard
AltGr and then search where this thing is
Hey great video, it’s been really helpful to make my new game but next time you make a video can you put the script in the comments or description so we can copy and paste to speed things up a little, just a little suggestion but keep up the great work👍
Its for learning, he obviously wont put it so u can copy n paste it :v
Please help give me the script copy pasted I think I did smtg wrong
didnt work at all
I got the script But not all if yall Want local Plots = game.workspace.Plots
-- Player Joins a game
game.Player.PlayerAdded:Conect(function(Player)
-- Get a plot
for _, plot in Plots:GetChildren() do
if plot:GetAttributen("Taken") then continue end
-- plot is not Taken, so we want to take it
plot:SetAttribute('Taken', true
plot:SetAttribute('Owner', player.UserId)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
for _, plot in Plots:GetChildren() do
if not plot:GetAttribute('Owner') then continue end
-- the plot is owned by a player
if plot:GetAttribute('Ownner')
end
end)
ths if itemClone:IsA('Model ') then
itemCFrame = itemClone:GetPivot()
elseif itemClone:IsA('BasePart') then
itemCFrame = itemClone.CFrame
end
not work for me help pls
local Plots = game.Workspace.Plots
--Player joins a game
game.Players.PlayerAdded:Connect(function(player)
--get a plot
for _, plot in Plots:GetChildren() do
if plot:GetAttribute("taken") then continue end
-- plot is not taken, so we want to take it
plot:SetAttribute("Taken", true)
plot:SetAttribute("owner", player.UserId)
end
end)
game.Players.PlayerRemoving:Connect(function(player))
for _, plot in Plots:GetChildren()do
if not plot:GetAttribute("owner")then continue end
-- the plot is owned by a player
if plot:GetAttribute("owner") ~= player.UserId then continue end
-- we have found the correct plot
plot:SetAttribute("taken",nil)
plot:SetAttribute("owner",nil)
end
end
why cant i print ' plot has been given to/taken from (me) ! '?
oh my bad bro i was running it not playing it
broooo, this NEVER WORKS, i script and build THE RIGHT WAY, and it NEVER WORKS!!!
I’m making a Roblox game but it’s hard 😢. And I don’t know coding.
0/10
Help my attributes don't say owner or the id.
Same
Same
same
@@NOTHUMANGAMES same
Same fr
I'm watching in June 2024, Can somebody give me suggestions on why this isn't working?
Yes I know why, in the plot:SetAttribute ('taken , true') and plot:SetAttribue ('Owner' , player.UserId), they should be " not '. Hope this helps😊
@@FutureMrAtomic thanks, thats such a small difference yet it fixed it
@@FutureMrAtomicwhy it didnt work? Where do you even put that
@@Dummycatt in the script, it's written there
it says person not valid member to game datamodel
😅 I didn’t copy the script. I just wrote them on my keyboard lol
how do I type this double this straight ´´
"
@@euprimoeu how im on Mac
copy it you dummy😭😭@@MarkBlox807
*phew!* thank god this is actually close to the studio update!! the other ones from like two years ago don't work as often.
In my output, it says player is not a valid member of data model “ game” does anybody know how to fix this?
Edit: also, it doesn’t say I own a plot when I check the properties
“ a valid member of Workspace “Workspace” “ I don’t understand
u just earned a new sub! :D
ur telling me u never watched him back in 2018?
@@Tvpco. i do, why u 4 months late😭
@@Matie453 Because I unsubbed to all roblox devs and i didnt know he made more vids
Please can u make a updated version of a story tutorial?
Help why when I try to test does it say rendering is paused for debugging
Guys i need help it said “players is not a valid member of data model “game” what sould i do!
broo how to select 5 or 6 part Together in one go 1:50 like this
@AlvinBlox Where do I put the attributes?
game.player.playerremoving:connect(function(player)
hey so uh, nothing comes up in the developer panel when I click test, does anyone know why?
You have to click play but it doesn’t work
@@Roblox_Bacon80I know that you have to click play
Roblox AI is smarter than this guy 20 min wasted
my code got angry at me because I "Put unexpected global plots" in
My cat sat on my keyboard while I’m trying to code 😂
this was great but i thought that you were gonna hack me because ........ oh well
how do u move the plot is it just a click and drag becaus ehtat isnt moving it for me?
Can anyone put the script in the comments so I can copy and paste it?
Why can’t I see the attributes for the plots?
Why doess my studio look white and and i cant see my output
chat gpt can find the mistakes in your code just copy your code and go to chat gpt and paste
Why did it not add the attributes for me?
For some odd reason my avatar is invisible now-
can you send me the script
I don't have any attributes
For me when I hit start none of the plots have the two attributes, any idea what’s happening?
Hard to say, look through the code and write print statements to see which lines execute
Thanks I figured it out
@@kriptoVR what was the probelm? I have it too
how did you fix it, it happened to me to
THANKS its really useful to explain why did you write the line, I've learned so many usages here
i just love british ppl (the accent ofc)
plot:getattribute('taken', false)
Open The Tab To The Script:
local Plots = game.Workspace.Plots
-- player joins a game
game.Players.PlayerAdded:Connect(function(player)
-- get a plot
for _, plot in Plots:GetChildren() do
if plot:GetAttribute("Taken") then continue end
--plot is not taken
plot:SetAttribute('Taken',true)
plot:SetAttribute('Owner', player.UserId)
print('Plot Has Been Gived To'..player.Name.'!')
break
end
end)
game.Players.PlayerRemoving:Connect(function(player)
for _, plot in Plots:GetChildren() do
if not plot:GetAttribute('Owner') then continue end
--the plot is owned by a player
if plot:GetAttribute('Owner') ~= player.UserId then continue end
-- we have found correct plot
plot:GetAttribute('Taken', nil)
plot:GetAttribute('Owner', nil)
print('Plot Has Been Removed From'..player.Name.'!')
break
end
end)
thks so much i am making my first scripted game
You know refreshing with a tycoon game seems a great idea!
My attributes don’t appear on the plot it gave me 😢
my plots file doesn't show when I test it
bro it didnt work it gave me an error and i directly copied all of your code
The code is not working pls help i do not know what went wrong
MY attribute is saying that nothing is written
can someone comment the script pls
I did everything and it does not work bro im so done
thank you so much british man
Bro thanks You're the best
plot:setattribute( 'taken', true
for some reason, I dont have any attributes in any plot (despite copying the script)
is there a way to fix it?
Do you might to take subtitle in your videos ? Brazillian subtitle pls 😅
I have a problem with line 17. I says “ServerScriptSetvice.PlotHandler:17: Expected ‘=‘ when parsing assignment, got ‘in’ “
Can anyone help me on this
The getchildren thing won't work with Nil for some reason. What is this issue?
same
I cant do attributes
I followed the whole script but I kept getting mistakes after I fixed the other, I am stuck on a line 9 please help!! (it says that player.UserID isn't a member of (myusername)!!!)
I keep getting "ServerScriptService.PlotHandler:17: continue statement must be inside a loop " does anyone know how to fix?
It says that I’ve spelt plot wrong on the code ‘plot:SetAttribute( ‘Taken’ , nil)’ wrong but I haven’t. My code therefore doesn’t work. How do I fix it?
its not woking for me ;-; idk how to fix it
erm how do you get into the output 🤓
Pls help me with the attributes
dosent give any attributes