generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script in GUI not working?

Previous Thread :: Next Thread 
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
12 Sep 2015 12:41 AM
okay so i have a face toggler gui that changes from a set face and your own face
but its not toggling back to your normal face. here is the script:
local vamp=false
script.Parent.MouseButton1Click:connect(function()
local name= script.Parent.Parent.Parent.Parent.Name
local me=game.Workspace:FindFirstChild(name)
local text=me.Head.face.Texture

if vamp==false then
me.Head.face.Texture="rbxassetid://148892430"
else
me.Head.face.Texture=text
end
print'changed!'
print'reset'
if vamp==true then
vamp=false
else
vamp=true
end
end)

Thanks for the help

~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
12 Sep 2015 12:45 AM
vamp is what i decided to call the varible that holds the toggle


~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
12 Sep 2015 12:58 AM
bump


~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 05:45 PM
kay no one is responding


~Cool
Report Abuse
TheFurryFish is not online. TheFurryFish
Joined: 08 Jun 2011
Total Posts: 3433
13 Sep 2015 05:46 PM
are there any errors?
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 05:59 PM
lemme check it real quick but from what i remember, no


~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:00 PM
nope


~Cool
Report Abuse
R0Y8 is not online. R0Y8
Joined: 13 Jul 2014
Total Posts: 160
13 Sep 2015 06:07 PM
I think the mistake may have been that you didn't do vamp.Value

local vamp.Value=false
script.Parent.MouseButton1Click:connect(function()
local name= script.Parent.Parent.Parent.Parent.Name
local me=game.Workspace:FindFirstChild(name)
local text=me.Head.face.Texture

if vamp.Value==false then
me.Head.face.Texture="rbxassetid://148892430"
else
me.Head.face.Texture=text
end
print'changed!'
print'reset'
if vamp.Value==true then
vamp.Value=false
else
vamp.Value=true
end
end)
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:08 PM
Well its a bool variable but i could update it to that and try it that way


~Cool
Report Abuse
R0Y8 is not online. R0Y8
Joined: 13 Jul 2014
Total Posts: 160
13 Sep 2015 06:09 PM
Try it out I guess
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:10 PM
It could be the fact that the if isn't working correctly because it works when i turn it on, but not off


~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:12 PM
Or Perhaps its the saved face texture not working, lemme try to set up a value for tht also and test
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:14 PM
I'll make a video and show whats wrong


~Cool
Report Abuse
R0Y8 is not online. R0Y8
Joined: 13 Jul 2014
Total Posts: 160
13 Sep 2015 06:18 PM
Try doing

local vamp = Instance.new("BoolValue", script.Parent)
vamp.Value = false
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:19 PM
i
have the value in the gui, inserted before the game starts

~Cool
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:20 PM
i also made a youtube video to show the demo
its a bit long tho
link:
https://www.youtube.com/watch?v=cqNDdSpyZKg&feature=youtu.be


~Cool
Report Abuse
R0Y8 is not online. R0Y8
Joined: 13 Jul 2014
Total Posts: 160
13 Sep 2015 06:26 PM
local text.Value = me.Head.face.Texture

maybe that was the problem?
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:27 PM
i'm not exactly sure what the error is because it could be:
The If Statements
The Text variable.
that is all


~cool (i screwed up my auto sig)
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
13 Sep 2015 06:28 PM
@R0Y
What on earth are you talking about.
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:29 PM
ohai clone.


Report Abuse
R0Y8 is not online. R0Y8
Joined: 13 Jul 2014
Total Posts: 160
13 Sep 2015 06:30 PM
lol sorry CloneTrooper1019
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
13 Sep 2015 06:31 PM
Okay, here's a fix.
In order for this to work, it needs to be a LocalScript

local vamp = false
local player = game.Players.LocalPlayer
local oldFace = nil

local function onClicked()
local char = player.Character
if char then
local head = char:WaitForChild("Head")
local face = head:WaitForChild("face")
vamp = not vamp
if vamp then
oldFace = face.Texture
face.Texture = "rbxassetid://148892430"
else
face.Texture = oldFace
end
end
end

script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
13 Sep 2015 06:34 PM
Also, for future reference, don't use normal scripts inside of GUIs. Like, at all.
Report Abuse
COOLBRAYDENNOOB is not online. COOLBRAYDENNOOB
Joined: 11 Nov 2012
Total Posts: 87
13 Sep 2015 06:35 PM
Okay, Thanks everyone for all the help! i am really glad that you helped!


~Cool
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image