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 get my part to communicate with my GUI?

I have this game and it has two different game modes: Classic and spinner. I need my 'Game mode active' GUI to say which game mode is currently active, and make it disappear after 10 seconds. I'll include my game here as you may need to play it to get a better grip of what is going on. (You may need to wait a bit for the spinner to appear, the first game mode that shows up is random, but then it alternates.) Here is the script in the spinner that decides which game mode it will be.

local PickNum = math.random(1,2)
local spinner= script.Parent
spinner.CanCollide = false
spinner.Anchored = true
while true do
	if PickNum == 2 then
		spinner.Transparency = 0
	elseif PickNum == 1 then
		spinner.Transparency = 1
	end
	wait(180)
	PickNum = 3 - PickNum
end

And here is my UI:

file:///Users/adam/Desktop/Screenshot%202020-05-07%20at%2014.25.53.png

The Label at the top spanning the top of the screen will be my game mode active UI.

Here are the rest of the script for my spinner.

sphere = script.Parent
a = 0
 repeat
  sphere.Rotation = Vector3.new( 0, a, 0)
  wait(.01)
  a = a+3.5
 until false 

Third script:

local Debounce = false

script.Parent.Touched:connect(function(hit)
	if script.Parent.Transparency == 0 then
		if hit.Parent:FindFirstChild("Humanoid") and Debounce == false then
			Debounce = true
			hit.Parent.Humanoid:TakeDamage(35)
			wait(0.5)
			Debounce = false
		end
	end
end)

Can anyone help?

1 comment

0

ok adam, that picture does not work, try uploading it to gazyo

1 answer

✓ Accepted answer

You can make a StringValue in Replicated Storage to hold the gamemode name. In a local script housed inside of the TextLabel that you want to change, you could write:

game.ReplicatedStorage.StringValue.Changed:Connect(function(value) 
	script.Parent.Text = value 
	wait(10)
	script.Parent.Text = ""
end)

This would show text once the stringValue.Value is changed, and wait 10 seconds and make it disappear.

I hoope this helps

2 comments

0

I've done this and set the StringValue to 'Spinner' and called it StringValue. Literally nothing happened though.

0

You have to update the string value. It will not kick in by default.

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