Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Server Script
- local ProximityPromptService = game:GetService("ProximityPromptService")
- local Stands = game.Workspace.ShopStands
- local ShopEvent = game.ReplicatedStorage.ShopEvent
- local ProximityPromptUpdater = game.ReplicatedStorage.ProximityPromptUpdater
- local debounce = true
- game.Players.PlayerAdded:Connect(function(Player)
- local PlayerStandCheck = Instance.new("BoolValue")
- PlayerStandCheck.Parent = Player
- PlayerStandCheck.Value = false
- PlayerStandCheck.Name = "PlayerStandCheck"
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- stands:FindFirstChild("PricePart").Attachment.ProximityPrompt.Triggered:Connect(function(Player)
- if stands:FindFirstChild("Owned").Value == false and stands:FindFirstChild("PlayerName").Value == "" and Player:FindFirstChild("PlayerStandCheck").Value ~= true then -- and debounce
- -- print(Player)
- --debounce = false
- Player:FindFirstChild("PlayerStandCheck").Value = true
- stands:FindFirstChild("Owned").Value = true
- stands:FindFirstChild("PlayerName").Value = Player.Name
- stands:FindFirstChild("DescriptionPart").SurfaceGui.PlayerName.Text = Player.Name .. "'s stand"
- stands:FindFirstChild("DescriptionPart").SurfaceGui.PriceRaised.Text = Player.leaderstats.Raised.Value .. " raised"
- stands:FindFirstChild("DescriptionPart").SurfaceGui.PriceRaised.Visible = true
- -- stands.PricePart.SurfaceGui.Enabled = true -- player ownes clothes
- local Song = "Level Up"
- ShopEvent:FireClient(Player,Song)
- ProximityPromptUpdater:FireAllClients(Player)
- print("1")
- --return
- elseif stands:FindFirstChild("Owned").Value == true and stands:FindFirstChild("PlayerName").Value == Player.Name then
- -- stands.TextPart.SurfaceGui.TextLabel.Text = "StartTextEdit"
- -- debounce = false
- print("Its Your Stand")
- local Song = "Open Shop"
- ShopEvent:FireClient(Player,Song)
- print("2")
- elseif stands:FindFirstChild("Owned").Value == false and stands:FindFirstChild("PlayerName").Value == "" then
- -- debounce = false
- local Song = "No"
- ShopEvent:FireClient(Player,Song)
- print("you already have a stand")
- print("3")
- end
- -- debounce = true
- end)
- end
- end
- Player.CharacterAdded:Connect(function(Character)
- task.wait(.5)
- print("ProximityPromptUpdater fired")
- ProximityPromptUpdater:FireAllClients(Player)
- end)
- end)
- game.Players.PlayerRemoving:Connect(function(Player)
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value == Player.Name then
- stands.TextPart.SurfaceGui:FindFirstChild("TextLabel").Text = "Your Text Here"
- stands.DescriptionPart.SurfaceGui:FindFirstChild("PlayerName").Text = "unclaimed"
- stands.DescriptionPart.SurfaceGui:FindFirstChild("PriceRaised").Visible = false
- stands:FindFirstChild("PricePart").Attachment.ProximityPrompt.Enabled = true
- stands:FindFirstChild("Owned").Value = false
- stands:FindFirstChild("PlayerName").Value = ""
- ProximityPromptUpdater:FireAllClients(Player)
- print("Someone Left")
- end
- end
- end
- end)
- -- Update The Text thats Applied
- ShopEvent.OnServerEvent:Connect(function(Player,DescriptionBoardText)
- --print(DescriptionBoardText)
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value == Player.Name then
- stands.TextPart.SurfaceGui:FindFirstChild("TextLabel").Text = DescriptionBoardText
- end
- end
- end
- end)
- -- Local Script
- local TweenService = game:GetService("TweenService")
- local ProximityPromptService = game:GetService("ProximityPromptService")
- local ReplicateStorage = game:GetService("ReplicatedStorage")
- local ShopEvent = ReplicateStorage:WaitForChild("ShopEvent")
- local ProximityPromptUpdater = ReplicateStorage:WaitForChild("ProximityPromptUpdater")
- local Player = game.Players.LocalPlayer
- local Stands = game.Workspace.ShopStands
- local Camera = workspace.CurrentCamera
- Player.CharacterAdded:Wait()
- local RefreshButton = Player.PlayerGui:WaitForChild("EditTextGui").Frame.RefreshButton
- local CancelButton = Player.PlayerGui:WaitForChild("EditTextGui").Frame.CancelButton
- local ApplyButton = Player.PlayerGui:WaitForChild("EditTextGui").Frame.ApplyButton
- local TextBox = Player.PlayerGui:WaitForChild("EditTextGui").Frame.TextBox
- local DescriptionText = Player.PlayerGui:WaitForChild("DescriptionGui").Frame.TextLabel
- local debounce = true
- local function ShopOpen()
- local Blur = Instance.new("BlurEffect")
- Blur.Parent = game.Lighting
- Blur.Size = 10
- Player.PlayerGui:WaitForChild("EditTextGui").Enabled = true
- local tweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local object = Camera
- local object2 = Player.PlayerGui:WaitForChild("EditTextGui").Frame
- local goal = {FieldOfView = 60}
- local goal2 = {Position = UDim2.new(0.3, 0, 0.25, 0)}
- local tween = TweenService:Create(object, tweenInfo, goal)
- local tween2 = TweenService:Create(object2, tweenInfo, goal2)
- tween:Play()
- tween2:Play()
- --task.wait(2) -- Not sure if should keep the wait
- --Camera.FieldOfView = 70
- --Blur:Destroy()
- end
- local function Blink()
- local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local object = DescriptionText
- local goal = {TextTransparency = 1,Position = UDim2.new(0.349, 0, 0.603, 0)}
- local tween = TweenService:Create(object, tweenInfo, goal)
- tween:Play()
- end
- local function ShopClaim()
- local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local object = DescriptionText
- local object2 = Camera
- local goal = {TextTransparency = 1,Position = UDim2.new(0.349, 0, 0.74, 0)}
- local goal2 = {FieldOfView = 70}
- local tween = TweenService:Create(object, tweenInfo, goal)
- local tween2 = TweenService:Create(object2, tweenInfo, goal2)
- tween:Play()
- tween2:Play()
- end
- ApplyButton.MouseButton1Up:Connect(function()
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value == Player.Name then
- stands.TextPart.SurfaceGui.TextLabel.Text = TextBox.Text
- local DescriptionBoardText = TextBox.Text
- ShopEvent:FireServer(DescriptionBoardText)
- Player.PlayerGui:WaitForChild("EditTextGui").Enabled = false
- local Blur = game.Lighting:FindFirstChild("Blur"):Destroy()
- local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local object = Camera
- local object2 = Player.PlayerGui:WaitForChild("DescriptionGui").Frame.TextLabel
- local goal = {FieldOfView = 70}
- local goal2 = {TextTransparency = 1,Position = UDim2.new(0.349, 0, 0.603, 0)}
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextTransparency = 0
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Visible = true
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Text = "applied!"
- Player.PlayerGui.LocalSounds:FindFirstChild("Level Up Sound Effect"):Play()
- local tween = TweenService:Create(object, tweenInfo, goal)
- local tween2 = TweenService:Create(object2, tweenInfo, goal2)
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value == Player.Name then
- stands.PricePart.Attachment:FindFirstChild("ProximityPrompt").Enabled = true
- tween:Play()
- tween2:Play()
- task.wait(.4)
- object2.Position = UDim2.new(0.349, 0,0.74, 0)
- --Player.PlayerGui.DescriptionGui.Frame.TextLabel.Visible = false
- end
- end
- end
- end
- end
- end
- end)
- RefreshButton.MouseButton1Up:Connect(function()
- -- Refresh the clothes i guess and do some other stuff
- end)
- CancelButton.MouseButton1Up:Connect(function()
- Player.PlayerGui:WaitForChild("EditTextGui").Enabled = false
- local Blur = game.Lighting:FindFirstChild("Blur"):Destroy()
- local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
- local object = Camera
- local object2 = Player.PlayerGui:WaitForChild("DescriptionGui").Frame.TextLabel
- local goal = {FieldOfView = 70}
- local goal2 = {TextTransparency = 1,Position = UDim2.new(0.349, 0, 0.603, 0)}
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextTransparency = 0
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Visible = true
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Text = "canceled!"
- Player.PlayerGui:WaitForChild("LocalSounds").CloseButton:Play()
- local tween = TweenService:Create(object, tweenInfo, goal)
- local tween2 = TweenService:Create(object2, tweenInfo, goal2)
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value == Player.Name then
- stands.PricePart.Attachment:FindFirstChild("ProximityPrompt").Enabled = true
- tween:Play()
- tween2:Play()
- task.wait(.4)
- object2.Position = UDim2.new(0.349, 0,0.74, 0)
- end
- end
- end
- end)
- ShopEvent.OnClientEvent:Connect(function(Song)
- print(Song)
- print("debounce is:" .. tostring(debounce))
- if Song == "Level Up" and debounce then
- debounce = false
- Player.PlayerGui.LocalSounds:FindFirstChild("Level Up Sound Effect"):Play()
- local UIStroke = Instance.new("UIStroke")
- UIStroke.Thickness = 3
- UIStroke.ApplyStrokeMode = "Contextual"
- UIStroke.Parent = Player.PlayerGui.DescriptionGui.Frame.TextLabel
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Text = "Claimed"
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Visible = true
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextTransparency = 0
- DescriptionText.Position = UDim2.new(0.349, 0,0.603, 0)
- Camera.FieldOfView = 60
- ShopClaim()
- task.wait(.4)
- UIStroke:Destroy()
- print("Claiming Shop")
- elseif Song == "No" and debounce then
- debounce = false
- Player.PlayerGui.LocalSounds:FindFirstChild("no! sound effect"):Play()
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Text = "u already have a booth!"
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.Visible = true
- Player.PlayerGui.DescriptionGui.Frame.TextLabel.TextTransparency = 0
- -- DescriptionText.Position = UDim2.new(0.349, 0,0.603, 0)
- Blink()
- task.wait(.45)
- DescriptionText.Position = UDim2.new(0.349, 0,0.74, 0)
- print("NO")
- elseif Song == "Open Shop" and debounce then
- debounce = false
- print("Opening Shop")
- ShopOpen()
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- print(stands.Owned.Value == true)
- print(stands.PlayerName.Value == Player.Name)
- if stands:FindFirstChild("Owned").Value == true and stands:FindFirstChild("PlayerName").Value == Player.Name then
- -- debounce = false
- stands.PricePart.Attachment:FindFirstChild("ProximityPrompt").Enabled = false
- --wait(5)
- --ShopOpen()
- print("3")
- end
- end
- end
- end
- wait(.5)
- debounce = true
- end)
- ProximityPromptUpdater.OnClientEvent:Connect(function()
- for i,stands in pairs(Stands:GetDescendants()) do
- if stands:IsA("Model") and stands.Name == "ShopStand" then
- if stands.Owned.Value == true and stands.PlayerName.Value ~= Player.Name then
- stands.PricePart.Attachment.ProximityPrompt.Enabled = false
- elseif stands.Owned.Value == false and stands.PlayerName.Value == "" then
- stands.PricePart.Attachment.ProximityPrompt.Enabled = true
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement