It depends on how you want it to open specifically because you can do quite a bit with tweens to be very honest. Are you able to explain a little bit more on how you want the shop to open?
Can you explain it a little bit better? How would I fire the RemoteEvent and how would I start the UI?
I’m sorry if these are simple questions but I’m not a scripter
Nice! That works.
The animation seems to display after the second time the player opens the shop and is kinda laggy (I don’t know if that’s a studio thing or not) and the animation seems to not be working with the exit button.
local Frame = script.Parent -- Change to your frame
local ProximityPrompt = workspace.Lobby.Shopblock.Openshop -- Change to Proximity Prompt
local ExitShop = script.Parent.Exit
ProximityPrompt.Triggered:Connect(function(player)
Frame.Visible = true
Frame:TweenPosition(UDim2.new(0.5,0,0.5,0,"InOut","Linear",0.4,false))
end)
ExitShop.MouseButton1Click:Connect(function()
Frame:TweenPosition(UDim2.new(0.5,0,-0.5,0),"InOut","Linear",0.4,false)
task.wait(0.4)
Frame.Visible = false
end)
In replicated storage, you should add your Remote Event.
Call it: “OpenShop”
2. Setting up the proximity prompt
Go to your proximity prompt script and inside you’ll write this:
local RemoteEvent = game.ReplicatedStorage.OpenShop --This is your remote event
local ProximityPrompt = script.Parent -- Your Proximity Prompt
ProximityPrompt.Triggered:Connect(function(plr) -- This will give you the player that triggered it
RemoteEvent:FireClient(plr, "Shop") --Change the name Shop to Hat for the other proximity prompt
end)
3. Setting up the UI animation
local RemoteEvent = game.ReplicatedStorage.OpenShop
RemoteEvent.OnClientEvent:Connect(function(Shop)
if Shop == "Shop" then -- Change shop to Hat in the other script
local TweenService = game:GetService("TweenService")
local myInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
local Goal = {Size = UDim2.new(0.5,0,0.5,0)}
local Frame = script.Parent.Frame
local Tween = TweenService:Create(Frame, myInfo, Goal)
Tween:Play()
end
end)
Copy paste the exact same code for hat localscript!
The exit isn’t working because you opened the shop using the server script while the local script is trying to close it with the client (which it sees closed already)
As Don said, change the script to a local script and then paste this new code in, it should change the position before hand and work in a much smoother manner.
local Frame = script.Parent -- Change to your frame
local ProximityPrompt = workspace.Lobby.Shopblock.Openshop -- Change to Proximity Prompt
local ExitShop = script.Parent.Exit
Frame.Position = UDim2.new(0.5,0,-0.5,0)
ProximityPrompt.Triggered:Connect(function(player)
Frame.Visible = true
Frame:TweenPosition(UDim2.new(0.5,0,0.5,0,"InOut","Linear",0.4,false))
end)
ExitShop.MouseButton1Click:Connect(function()
Frame:TweenPosition(UDim2.new(0.5,0,-0.5,0),"InOut","Linear",0.4,false)
task.wait(0.4)
Frame.Visible = false
end)