Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a button that moves my GUI back to ReplicatedStorage ?

Hello I want to make a button that moves my GUI back to the ReplicatedStorage. (With the open script I move it to PlayerGUI)

Heres a Image of my Screen: https://www.imageupload.net/image/robloxstudioscreenshot.HUa9g

ScreenShower Script:

local ScreenGui = game.ReplicatedStorage.GUI.Cafe

script.Parent.MouseClick:Connect(function(mouse)
	local clone = ScreenGui:Clone()
	clone.Parent = mouse.PlayerGui
	end
end)


Animation LocalScript:

local Mouse = game.Players.LocalPlayer:GetMouse()
local button = script.Parent
local SK = false
local Plus = script.Parent.Follow
local Zone = script.Parent.Click
local SpeedS = 1
local TweenService = game:GetService("TweenService") 
local tweenClick = TweenInfo.new(SpeedS,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0)

button.MouseButton1Click:connect(function()	
	local G = Zone:Clone()
	G.Position = UDim2.new(0,Mouse.X-button.AbsolutePosition.X,0,Mouse.Y-button.AbsolutePosition.Y)
	G.Parent = button
	local tween = TweenService:Create(G, tweenClick, {Size = UDim2.new(1,0,1,0),ImageTransparency = 1})
	tween:Play()
	wait(SpeedS)
	G:Destroy()
end)

button.MouseEnter:Connect(function()
	SK = false
	Plus.Visible = false
	repeat wait()
		Plus.Position = UDim2.new(0,Mouse.X-button.AbsolutePosition.X,0,Mouse.Y-button.AbsolutePosition.Y)
		until SK == true do
	end
end)

button.MouseLeave:Connect(function()
	SK = true
	Plus.Visible = false
end)

Thanks for your great help ^^

1 comment

0

you want it to move when u press lets say K to replicated storage and if u press leys say L it will move back or smt ?

1 answer

✓ Accepted answer

Insert another button (Which you want to click to remove it like X button) then insert a server script that says:

local GUI = ______ -- show the GUI here

script.Parent.MouseClick:Connect(function(mouse)
	-- Insert tween animation, and when it's done write the next line
	GUI:Destroy()
end)

It will destroy only the clone, not the original one which is in the replicated storage. Thus, removing it safely.

This discussion is preserved as it was. New answers, comments, and votes are closed.