I want my tween to play each time someone click a part and a gui is tweened on to the screen. I click it, it work but when I remove it and click it again it doesn’t play it.
Here is my code:
local RP = game:GetService(“ReplicatedStorage”)
local Shop = script.Parent.Parent
local Frame = Shop.Frame
local TweenService = game:GetService("TweenService")
local PPService = game:GetService("ProximityPromptService")
local PP = game.Workspace.SpecShopPart.ProximityPrompt
local ShopAppear = RP.SpecShop
local button = game.Workspace.SpecShopPart.SurfaceGui.Frame.TextButton
local One = script.Parent.Text.One
local Two = script.Parent.Text.Two
local On = game.Workspace.SpecShopPart.On
Frame.Visible = false
On.Value = false
local AppearTween = TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local tweenA = TweenService:Create(script.Parent,AppearTween,{Position=UDim2.new(0.138,0,0.712,0)})
while wait() do
if On.Value == false then
button.Activated:Connect(function()
Frame.Visible = true
tweenA:Play()
On.Value = true
One.Value = true
end)
end
end
Could you show where your setting this value back to false, it could be that you pick up the value on the server, but then change it on the client meaning the server never picks it up as being changed.
I have two scripts to change it, one where you would say bye and one where if you complete what the person says and it open a gui here are the scripts:
Bye script:
local close = script.Parent
local On = game.Workspace.SpecShopPart.On
local One = script.Parent.Parent.Text.One
local Two = script.Parent.Parent.Text.Two
local Button = script.Parent.Parent.Text
local Hello = script.Parent.Parent.Text.Hello
local Text = script.Parent.Parent.TextLabel
close.Activated:Connect(function()
script.Parent.Parent.Visible = false
On.Value = false
One.Value = false
Two.Value = false
Button.Text = Hello.Value
Text.Text = "Hello, what can I help you with?"
end)
Complete dialogue script:
local Hello = script.Parent.Hello
local Look = script.Parent.Look
local On = game.Workspace.SpecShopPart.On
local closing = script.Parent.Closing
local One = script.Parent.One
local Two = script.Parent.Two
local Button = script.Parent
local Text = script.Parent.Parent.TextLabel
local Frame = script.Parent.Parent
while true do
wait()
if On.Value == false then
One.Value = false
Two.Value = false
Button.Text = Hello.Value
Text.Text = "Hello, what can I help you with?"
end
end
Extra script where it changes the text and all:
local Hello = script.Parent.Hello
local Look = script.Parent.Look
local Shop = script.Parent.Parent.Parent.Shop
local On = game.Workspace.SpecShopPart.On
local closing = script.Parent.Closing
local One = script.Parent.One
local Two = script.Parent.Two
local Button = script.Parent
local Text = script.Parent.Parent.TextLabel
local Frame = script.Parent.Parent
local TweenService = game:GetService("TweenService")
local ShopOpen = TweenInfo.new(1,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local tweenB = TweenService:Create(Shop,ShopOpen,{Position=UDim2.new(.26, 0,0.19, 0)})
while true do
wait()
if On.Value == true and One.Value == true then
Button.Text = Hello.Value
break
end
end
Button.Activated:Connect(function()
wait(1)
One.Value = false
Two.Value = true
Button.Text = Look.Value
Text.Text = "Alright, take a look at my shop!"
closing.Value = true
end)
Button.Activated:Connect(function()
if Button.Text == "Ok" then
wait(1)
Frame.Visible = false
On.Value = false
tweenB:Play()
script.Parent.Parent.Parent.Shop.Visible = true
end
end)
(tweenB is to open the shop) and I am sorry if this is alot
Assuming “close” is a button, you would want to use the .MouseButton1Click event for this, same with your other parts in the code, instead of .Activated, you should use MouseButton1Click.
As far as the rest goes, make sure your checking you have the right values, etc.
Could you tell me if these are both scripts? I’m confident this is most likely a value issue or an issue with the script locations
I don’t understand the part wether if it is a script but I changed all the activated with the MouseButton1Click event and it didn’t change anything. And they are all local scripts if that is what you meant
I don’t see that you getting your GUI back on start place. I mean, your GUI just getting to the end position with Tweening but if you click again it just appears on same place where tween ended? I need more answers. If it’s just appears on same place where tween was ended, then make sure to move gui back when making it’s not visible.