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

Tween Gui ontouch part?

Asked by
yoshi8080 445 Moderation Voter
8 years ago

Not sure it's possible but so errors show while testing this script?

function move(Gui)
game.StarterGui.GuiMain.Frame:TweenPosition(UDim2.new(0.001,0,0,0),"Out", "Quad", .9)
end
function onTouch(part)
move(script.Parent) 

end

I'ma bit new to tweening, any tips on tweening would help me!

2 answers

Log in to vote
0
Answered by 8 years ago

I don't know if it's when you hit a part in Workspace, but if it is then this works

function move(Gui)
game.StarterGui.GuiMain.Frame:TweenPosition(UDim2.new(0.001,0,0,0),"Out", "Quad", .9)
end

function onTouch(part)
move(script.Parent) 
end

game.workspace.PARTNAMEHERE.Touched:connect(onTouch)
0
Doesn't work? yoshi8080 445 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

I'm not sure if you included a listener on the .Touched event.

I think you meant:

yourPart = game.Workspace.ExamplePart;

function move(Gui)
Gui:TweenPosition(UDim2.new(0.001,0,0,0),"Out", "Quad", .9)
end
function onTouch(part)
move(script.Parent) 
end

yourPart.Touched:connect(onTouch);

Also, I would suggest putting the tweening function into a LocalScript and the touched listener into a normal script or else it might not work correctly. I would suggest allowing the normal script to call the tweening function using a remote event.

0
How would I do that? I never used RemoteEvents before >.< yoshi8080 445 — 8y
0
Go onto the wiki and search it. There's a good tutorial on it. You could probablly just CP most of the code. ProtectedMethod 105 — 8y
0
It's very confusing for me >.< I'm not sure which to use for this script. yoshi8080 445 — 8y
0
What do you mean which to use? You will need a localscript and a normal script. You will need a RemoteEvent in the local script. ProtectedMethod 105 — 8y
View all comments (3 more)
0
Like using RemoteEvents, the information on the wiki yoshi8080 445 — 8y
0
Is that a question? If so, I don't uderstand what you're asking. ProtectedMethod 105 — 8y
0
Ignore What I said before, I was confused on these parts: Location of the local script, and the OnTouched function. I think the OnTouched has to be fixed, but how to, er fix it... yoshi8080 445 — 8y

Answer this question