Boat not spawning when selected

So I am currently working on a game with another user who just hired me. For the game, he is trying to make a system in it for when the game starts, your supposed to select a boat and it is supposed to spawn next to you. The system will also not close when said boat is selected. How would I fix these?

Please provide code for us to help you.

Do you have the code, so we can pinpoint why the boat isn’t spawning.

1 Like

Code for selection
~~
local Selector = game.ReplicatedStorage.Selector
while true do
if Selector.Value == false then
wait(45)
script.Parent.Visible = true
wait(15)
script.Parent.Visible = false
Selector.Value = true
wait(120)
Selector.Value = false
end

end
~~
The client
~~
local Boats = script.Parent.Boats
local Remotes = game.ReplicatedStorage.Remotes

Boats.raft.MouseButton1Click:Connect(function()
if Remotes.Spawnboat:InvokeServer(Boats.raft.Name) == true then
Boats.raft.Text = “Selected”

	Boats.rescue.Text = "Choose"
end

end)

Boats.rescue.MouseButton1Click:Connect(function()
if Remotes.Spawnboat:InvokeServer(Boats.NoobBoat.Name) == true then
Boats.NoobBoat.Text = “Selected”

	Boats.SuperBoat.Text = "Choose"
end

end)
~~
Timer:
~~
local status = game.ReplicatedStorage.Status
local timerdisplay = script.Parent.timerdisplay

status.Changed:Connect(function()
timerdisplay.Text = status.Value
end)
~~

Code for selection
~~
local Selector = game.ReplicatedStorage.Selector
while true do
if Selector.Value == false then
wait(45)
script.Parent.Visible = true
wait(15)
script.Parent.Visible = false
Selector.Value = true
wait(120)
Selector.Value = false
end

end
~~
The client
~~
local Boats = script.Parent.Boats
local Remotes = game.ReplicatedStorage.Remotes

Boats.raft.MouseButton1Click:Connect(function()
if Remotes.Spawnboat:InvokeServer(Boats.raft.Name) == true then
Boats.raft.Text = “Selected”

	Boats.rescue.Text = "Choose"
end

end)

Boats.rescue.MouseButton1Click:Connect(function()
if Remotes.Spawnboat:InvokeServer(Boats.NoobBoat.Name) == true then
Boats.NoobBoat.Text = “Selected”

	Boats.SuperBoat.Text = "Choose"
end

end)
~~
Timer:
~~
local status = game.ReplicatedStorage.Status
local timerdisplay = script.Parent.timerdisplay

status.Changed:Connect(function()
timerdisplay.Text = status.Value
end)
~~
~

Can you use a code block please, so it’s easier to view. You can do this by doing ```lua at the start

Oh alright
Code for selection
~~

while true do
	if Selector.Value == false then
		wait(45)
		script.Parent.Visible = true
		wait(15)
		script.Parent.Visible = false
		Selector.Value = true
		wait(120)
		Selector.Value = false
	end

end
~~
The client
~~
```local Boats = script.Parent.Boats
local Remotes = game.ReplicatedStorage.Remotes



Boats.raft.MouseButton1Click:Connect(function()
	if Remotes.Spawnboat:InvokeServer(Boats.raft.Name) == true then
		Boats.raft.Text = "Selected"

		Boats.rescue.Text = "Choose"
	end
end)

Boats.rescue.MouseButton1Click:Connect(function()
	if Remotes.Spawnboat:InvokeServer(Boats.NoobBoat.Name) == true then
		Boats.NoobBoat.Text = "Selected"

		Boats.SuperBoat.Text = "Choose"
	end
end)
~~
Timer:
~~
```local status = game.ReplicatedStorage.Status
local timerdisplay = script.Parent.timerdisplay

status.Changed:Connect(function()
	timerdisplay.Text =  status.Value
end)
~~

Here is the code better formatted.

--Code for selection
local Selector = game.ReplicatedStorage.Selector
while true do
   if Selector.Value == false then
      wait(45)
      script.Parent.Visible = true
      wait(15)
      script.Parent.Visible = false
      Selector.Value = true
      wait(120)
      Selector.Value = false
   end
end


-- The client
local Boats = script.Parent.Boats
local Remotes = game.ReplicatedStorage.Remotes

Boats.raft.MouseButton1Click:Connect(function()
   if Remotes.Spawnboat:InvokeServer(Boats.raft.Name) == true then
      Boats.raft.Text = “Selected”
      Boats.rescue.Text = "Choose"
   end
end)

Boats.rescue.MouseButton1Click:Connect(function()
   if Remotes.Spawnboat:InvokeServer(Boats.NoobBoat.Name) == true then
      Boats.NoobBoat.Text = “Selected”
      Boats.SuperBoat.Text = "Choose"
   end
end)

--Timer

local status = game.ReplicatedStorage.Status
local timerdisplay = script.Parent.timerdisplay

status.Changed:Connect(function()
   timerdisplay.Text = status.Value
end)
2 Likes

Ah alright sorry for the confusion.

I don’t really understand this post, and I’m not trying to make this comment as negatively as you think it’s supposed to be.
Also thanks for the formatted code, @TheDCraft

You claim

No offense, but in the code, it shows no attempts of closing the system. It only shows you doing

When you make a action via script such as this, you have to reverse the changes if your goal is that.

how would I do that then because I am not that sure how to

And what I was meaning is after said player selects their boat or after the timer runs out, the gui to select the boat is supposed to close.

Yeah but in your code, it clearly shows you had no attempt of “closing” it, it seems you think Lua or Roblox Studio will reverse the changes, and making everything go back to normal, but it is not always what you think. It is much different. When you make a change with a script, you cannot reverse it unless you do it again but changing the value to " " with the same or different script.


Recommendation, get better at Lua inside of Roblox Studio.

Note, I may seem rude with these comments but your issue is a bit too vague, and you’re missing the most important stuff.
Which then leads me to having to create code for you, which we don’t want to because we could be replying by phone, laptop, etc. Or we just may not have the time to do it, or we are lazy to do it.