doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 01 Apr 2015 08:13 PM |
I'm new to scripting, and this is my first script from scratch I've ever made, so don't judge me please.
Anyways, the idea of the script was to make a textbox fade in, covering the whole screen, and then disappear 3 seconds after its visibility = 0.
I checked output, and it doesn't say anything when I touch the brick. The script is located in the brick. Here's the script I have so far:
debounce = false function onTouched(hit) if debounce == false then debounce = true gui = Instance.new("ScreenGui") gui.Parent = game.StarterGui.Model text = Instance.new("TextBox") text.Parent = game.StarterGui.Model.ScreenGui text.Active = true text.BackgroundColor3 = Color3.new(0, 0, 0) text.Size = UDim2.new(1, 1, 1, 1) text.Font = "SourceSans" text.FontSize = "Size48" text.Text = "You seem to be dreaming..." text.TextColor3 = Color3.new(255, 255, 255) text.BackgroundTransparency = 1 text.TextTransparency = 1 wait(.5) text.BackgroundTransparency = .9 text.TextTransparency = .9 wait(.5) text.BackgroundTransparency = .8 text.TextTransparency = .8 wait(.5) text.BackgroundTransparency = .7 text.TextTransparency = .7 wait(.5) text.BackgroundTransparency = .6 text.TextTransparency = .6 wait(.5) text.BackgroundTransparency = .5 text.TextTransparency = .5 wait(.5) text.BackgroundTransparency = .4 text.TextTransparency = .4 wait(.5) text.BackgroundTransparency = .3 text.TextTransparency = .3 wait(.5) text.BackgroundTransparency = .2 text.TextTransparency = .2 wait(.5) text.BackgroundTransparency = .1 text.TextTransparency = .1 wait(.5) text.BackgroundTransparency = 0 text.TextTransparency = 0 wait(3) gui:remove() debounce = false end end
script.Parent.Touched:connect(onTouched)
I'm planning on making the textbox fade out as well, but it'd be better to fix this part first. Can anyone maybe point out something that's not right in the script? I can't find any problems, but like I said, I'm a noob to scripting. |
|
|
| Report Abuse |
|
|
|
| 01 Apr 2015 08:17 PM |
| http://wiki.roblox.com/index.php?title=Loops |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 01 Apr 2015 08:33 PM |
Is this any better?
debounce = false function onTouched(hit) if debounce == false then debounce = true gui = Instance.new("ScreenGui") gui.Parent = game.StarterGui.Model text = Instance.new("TextBox") text.Parent = game.StarterGui.Model.ScreenGui text.Active = true text.BackgroundColor3 = Color3.new(0, 0, 0) text.Size = UDim2.new(1, 1, 1, 1) text.Font = "SourceSans" text.FontSize = "Size48" text.Text = "You seem to be dreaming..." text.TextColor3 = Color3.new(255, 255, 255) bt = text.BackgroundTransparency bt = 1 repeat bt = (bt-0.1) wait(.5) until bt == 0 t = text.TextTransparency t = 1 repeat t = (t-0.1) wait(.5) until t == 0 wait(3) gui:remove() debounce = false end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 01 Apr 2015 08:35 PM |
| Nevermind, just saw a huge mistake there. |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 01 Apr 2015 08:45 PM |
"gui.Parent = game.StarterGui.Model"
i believe you want to parent the GUI to the player's playergui |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 01 Apr 2015 08:46 PM |
"text.TextColor3 = Color3.new(255, 255, 255)"
color3s only go from 0 to 1
so, you would do,
text.TextColor3 = Color3.new(1,1,1)
not sure what color that would get you though |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 01 Apr 2015 08:54 PM |
here, i'll try to help you out here
brick = script.Parent debounce = false debounceTime = 3
function onTouch(hit) plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr and debounce == false then debounce = true screengui = Instance.new("ScreenGui", plr:FindFirstChild("PlayerGui") frame = Instance.new("Frame", screengui) text = Instance.new("TextLabel", frame) text.Size = UDim2.new(1,1,1,1) text.Text = "You seem to be dreaming.." wait(debounceTime) debounce = false end end
brick.Touched:connect(onTouch)
i guess start it off from there |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 01 Apr 2015 10:02 PM |
http://www.roblox.com/GUI-brick-demonstration-for-doggy-item?id=232902987
here, i made a model that works and is commented out for you |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2015 12:34 AM |
for gui u need Color3.new(255/255/255)
I am hamburgler man. Running over hamburgers with my van. If I miss it first, I will eat it in reverse! |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
| |
|
|
| 02 Apr 2015 03:29 PM |
for i=1, 0, -0.1 do text.BackgroundTransparency = i text.TextTransparency = i end |
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 02 Apr 2015 03:29 PM |
@chicken
you need to do the color3 value divdided by 255.
example:
Color3.new(14/255, 133/ 255, 200/ 255) |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2015 04:21 PM |
| i know. i left it4 him to edit. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 02 Apr 2015 04:30 PM |
Put it in PlayerGui, NOT StarterGui.
e.g.
script.Parent = game.Players.LocalPlayer.PlayerGui |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2015 04:33 PM |
@above its cloned into playergui if its there b4 game starts |
|
|
| Report Abuse |
|
|