Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I get my part to communicate with my GUI?

Asked by 4 years ago

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?

0
ok adam, that picture does not work, try uploading it to gazyo marine5575 359 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You can make a StringValuein Replicated Storage to hold the gamemode name. In a local script housed inside of the TextLabelthat 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

0
I've done this and set the StringValue to 'Spinner' and called it StringValue. Literally nothing happened though. Halbolonen 20 — 4y
0
You have to update the string value. It will not kick in by default. Sir_Ragealot 72 — 4y
Ad

Answer this question