Getting straight to the point, I am creating a story game at the moment. I am trying to get a part where you have to choose in order to continue. Like in Daycare Story 2, where you choose what team you want to play for soccer. How would you do something like this?
make 2 buttons in a gui name one of them, for example “red” and the second one “blue”
--inside the red button make a team for red
script.Parent.MouseButton1Down:Connect(function()
game.Players.LocalPlayer.TeamColor = game.Teams.RedTeam.TeamColor
end)
--inside the blue one
script.Parent.MouseButton1Down:Connect(function()
game.Players.LocalPlayer.TeamColor = game.Teams.BlueTeam.TeamColor
end)
is this what you need?
I am not trying to make teams like in Jailbreak. I wanna make it so - Ok better example. I want to make it so they can choose what type of Food they want. Like Pizza or burgers. A Gui will pop up. prompting them to choose and whatever on they choose, they get it selected into there inventory.
Are you looking for like some kind of voting system?
Yeah, like voting for a specific item people want. But not for everyone though
okay then
--burger gui
--put in localscript
script.Parent.MouseButton1Down:Connect(function()
game.ReplicatedStorage.GiveBurgerEvent:FireServer(game.Players.LocalPlayer)
end)
--server script
game.ReplicatedStorage.GiveBurgerEvent.OnServerEvent:Connect(function(p,plr)
local Burger = game.ReplicatedStorage:FindFirstChild("Burger"):Clone()
Burger.Parent = plr.Backpack
end)
Ok, yes, but how am I going to make a GUI for this to allow players to press on it and would this work for all types of Food models?
make a gui button insert a script into it, in replicated storage make an event called “GiverBurgerEvent” then make a burger tool in replicated storage name “Burger” and do the same for every food you want to add
And I can still use the scripts that was provided by you?
yes 30characterslongaaaaaaaa30character
just change one of the variables to that specific item
--burger gui
--put in localscript
script.Parent.MouseButton1Down:Connect(function()
game.ReplicatedStorage.GiveBurgerEvent:FireServer("burger")
end)
--fries gui
--put in localscript
script.Parent.MouseButton1Down:Connect(function()
game.ReplicatedStorage.GiveBurgerEvent:FireServer("Fries")
end)
--server script
game.ReplicatedStorage.GiveBurgerEvent.OnServerEvent:Connect(function(p, item)
if item == "burger" then
-do thing to obtain buger
elseif item == "Fries" then
-same for here
end
end)
Add remote functions. They’re like remote events but they return data. So when they choose burger, you can just return like string or whatever and then code it in the local script
k thank you I will test it you now
(30 Characters)
So, I can still place a GUI inside of the code?
wdym exactly by that?
(30 characters)
Like, would I need to make my own code to allow the GUI to show onto the screen?
how to attach a file?
30characters
No, I am not attaching any files. I dont understand what you mean.
Yes, you would still need a system to show the gui onto the screen.
Some methods you could use the the .Visible
boolean property, or a more commonly used and nicer looking method is :TweenPosition.