Hi, Scripters! I have a task I need help with where I’ve tried so hard to make it function. In this local script, Badpart is the part that is being touched, IntVal is a value being stored in ReplicatedStorage and Luck is a Text Lable being stored in the StarterGui, held inside a ScreenGui. When the block is touched, the numbers one or two will be generated from another script that leads to the IntVal in ReplicatedStorage. Then, this script finds that value and uses it to judge which if statement it fits into.
As you can see, I’ve added some print statements for testing purposes, which do print out. The only issue I’m having is actually making the text appear on the player’s screen. Here is the code:
local Badpart = game.Workspace.Badpart local IntVal = game.ReplicatedStorage.IntVal local Luck = script.Parent.Luck Luck.Text = "Test" wait(3) Luck.Text = "" while true do if Badpart.Touched == true then if IntVal.Value == 2 then print("You doubled your Money!") Luck.Text = "You doubled your Money!" wait(2) Luck.Text = "" elseif IntVal.Value == 1 then print("Oh no! You lost half your money!") Luck.Text = "Oh no! You lost half your money!" wait(2) Luck.Text = "" end print("GUI Working...") end wait() end
I will be active for a decent bit if you have any more questions about the code. Thanks to those who can help!