Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make it so this Appears for everyone?

I am making a dungeon game on roblox, and whenever you enter a dungeon, a start button is on the screen, when you press it, it counts down then it removes the invisible wall that is blocking the enterance to fight the enemys. BUT i cannot find a way to make this appear for everyone! if someone else starts it, if you press the button the :go!!!" is stuck on your screen! can anyone help? thanks/

script.Parent.MouseButton1Click:Connect(function()
	local count = script.Parent.Parent.count
	count.Visible = true

	script.Parent.Visible = false
	wait(1)
	count.Text = 4
		wait(1)
	count.Text = 3
		wait(1)
	count.Text = 2
		wait(1)
	count.Text = 1
		wait(1)
	count.Text = "GO!!!"
		game.Workspace["startpart"]:Destroy()
		game.Workspace["startpart1"]:Destroy()
		game.Workspace["startpart2"]:Destroy()
		game.Workspace["startpart3"]:Destroy()
		game.Workspace["startpart4"]:Destroy()
		game.Workspace["startpart5"]:Destroy()
		game.Workspace["startpart6"]:Destroy()
		game.Workspace["startpart7"]:Destroy()
		game.Workspace["startpart8"]:Destroy()
		game.Workspace["startpart9"]:Destroy()
	script.Parent.Parent:Destroy()
end)

1 comment

0

The start parts are just the barrier that is blocking the entrance of the dungeon.this script is in a text button btw.

2 answers

✓ Accepted answer

The problem you're having here is that you're trying to make changes to the server from a client which you can't do. Instead you can use remote events to send messages to and from the server and client to get your problem solved. You're also not removing the text after it says "Go!!!" so it stays on screen forever. I've written two scripts that you can use as an example and change to fit your needs. Here's what the explorer looks like:

A model named "Door" in the workspace with the parts of the door inside

Two RemoteEvents in ReplicatedStorage named "Ready" and "OpenDoor"

A ScreenGui named "ScreenGui" inside of StarterGui with a TextButton named "OpenDoor" and a TextLabel named "Counter" both inside the ScreenGui

A Script inside of ServerScriptService (Name doesn't matter)

A LocalScript inside of StarterPlayer > StarterPlayerScripts (Name doesn't matter)

Here's the server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local readyEvent = ReplicatedStorage:WaitForChild("Ready")
local openDoorEvent = ReplicatedStorage:WaitForChild("OpenDoor")
local door = workspace.Door
local playerReadied = false

local function onReadyEventFired()
	if playerReadied == false then
		playerReadied = true
		openDoorEvent:FireAllClients()
		wait(5)
		door:Destroy()
	end
end

readyEvent.OnServerEvent:Connect(onReadyEventFired)

Here's the local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local readyEvent = ReplicatedStorage:WaitForChild("Ready")
local openDoorEvent = ReplicatedStorage:WaitForChild("OpenDoor")
local player = game:GetService("Players").LocalPlayer
local counterTable = {"5", "4", "3", "2", "1", "Go!!!"}
local openDoorButton = player.PlayerGui:WaitForChild("ScreenGui").OpenDoor
local counter = player.PlayerGui:WaitForChild("ScreenGui").Counter

local function onOpenDoorEventFired()
	openDoorButton.Visible = false
	for i = 1, #counterTable do
		counter.Text = counterTable[i]
		wait(1)
	end
	wait(2)
	counter.Text = ""
end

openDoorButton.MouseButton1Click:Connect(function()
	readyEvent:FireServer()
end)

openDoorEvent.OnClientEvent:Connect(onOpenDoorEventFired)

If you have any questions or problems with this answer, i'd be happy to clarify or fix it.

Hope this helps!

14 comments

0

Does Capitals matter? I followed your exact steps and got no solution :c also does the parts in the doors name's matter? does the body type set for the game matter?

0

Also is there any scripts in the button? i feel like thats the issues here

0

Capitals do matter, the parts name's in the door don't matter, body type doesn't matter. There aren't any scripts in the button, it's controlled from StarterPlayerScripts.

0

also iis the server script placed in the serverscritptservice?

0

Are you getting any errors?

0

Yes

0

I am getting a error called: Important is not a valid member of imagelabel 2 times.

0

Sorry for the late responce.

0

I don't think that error has anything to do with my answer, but if you can send me an image of your explorer I can try to help you fix it.

0

Also send the script that is erroring.

0

I am VERY sorry i got things mixed up that script was something else, BUT the button works but it doesn't display the countdown.

0

Does the Gui that displays the countdown have the Visible property set to True before you test it?

0

:O i just noticed that! Thank you so much! it works now!

0

Happy to help

yo i recommend you use this for your code instead, its a lot faster and more reliable.

script.Parent.MouseButton1Click:Connect(function()
	for i = -4,0,1 do
	wait()
	count.Text = i
	end
	wait(1)
	count.Text = "GO!!!"
	for i,v in pairs(workspace:GetChildren()) do
		if v:IsA("BasePart") and v.Name == string.find("starterpart") then
			v:Destroy()
		end
	end	
end)

2 comments

0

but dont i want it for it to show for everyone in the server?

0

make it a localscript

This discussion is preserved as it was. New answers, comments, and votes are closed.