-- Here the shop system/animation takes place. By the help of UiTrigger Event.
-- Services
local localPlayer = game:GetService("Players").LocalPlayer
-- Event
local ShopUiEvent = game:GetService("ReplicatedStorage").Events.UiTrigger
-- Instences
local PlayerGui = localPlayer.PlayerGui
local frameShop = PlayerGui:WaitForChild("Screen").Shop
local frameHotbar = PlayerGui:WaitForChild("Screen").Hotbar
local ExtButton = PlayerGui:WaitForChild("Screen").ShopExit
-- Values
local Cash = localPlayer:WaitForChild("Stats").Cash
local FoodHealth = localPlayer:WaitForChild("Stats").Food
local Electricity = game:GetService("ReplicatedStorage").Global.Electricity
local actionNameS
ShopUiEvent.OnClientEvent:Connect(function(actionName)
actionNameS = actionName
if frameShop.Visible ~= true then
frameShop.Visible = true
frameHotbar.Visible = false
ExtButton.Visible = true
localPlayer.Character.HumanoidRootPart.Anchored = true
ShopUiEvent:FireServer(actionName, false)
end
end)
ExtButton.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
ExtButton:TweenSize(UDim2.new(0.025, 0,0.04, 0),nil,nil,0.1,true)
end
end)
ExtButton.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
ExtButton:TweenSize(UDim2.new(0.03, 0,0.05, 0),nil,nil,0.1,true)
frameShop.Visible = false
frameHotbar.Visible = true
ExtButton.Visible = false
localPlayer.Character.HumanoidRootPart.Anchored = false
ShopUiEvent:FireServer(actionNameS, true)
end
end)
So you’re trying to make the mouse be able to move over the button in first person? Add this to your script somewhere.(GuiButton | Roblox Creator Documentation)