Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --//Server script for Stand Updater
- local ServerStorage = game:GetService("ServerStorage")
- game.Players.PlayerAdded:Connect(function(Player)
- local PlrStats = Instance.new("Folder",Player)
- PlrStats.Name = "PlrStats"
- local Stand = Instance.new("StringValue",PlrStats)
- Stand.Name = "Stand"
- Stand.Value = ""
- Player.CharacterAdded:Connect(function(Character)
- if Stand.Value ~= nil then
- local stands = ServerStorage:WaitForChild("Stands")
- local standToFind = stands:FindFirstChild(Stand.Value)
- if standToFind then
- local newStand = standToFind:Clone()
- newStand.Parent = Player.Backpack
- end
- end
- end)
- end)
- --//Arrow Script
- local Arrow = script.Parent
- local Click = Arrow:WaitForChild("Click")
- Click.MouseClick:Connect(function(player)
- local Backpack = player:FindFirstChild("Backpack")
- if Backpack then
- local Stands = game:GetService("ServerStorage"):WaitForChild("Stands")
- local PlrStats = player:WaitForChild("PlrStats")
- local currentStand = PlrStats:WaitForChild("Stand")
- local randomStand = math.random(1,3)
- if randomStand == 1 then
- --Give Stand1
- if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
- local prevStand = workspace:FindFirstChild(player.Name.." Stand")
- local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
- prevStand:Destroy()
- prev:Destroy()
- local Stand = Stands:FindFirstChild("Stand1"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand1"
- else
- local Stand = Stands:FindFirstChild("Stand1"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand1"
- end
- elseif randomStand == 2 then
- --Give Stand2
- if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
- local prevStand = workspace:FindFirstChild(player.Name.." Stand")
- local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
- prevStand:Destroy()
- prev:Destroy()
- local Stand = Stands:FindFirstChild("Stand2"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand2"
- else
- local Stand = Stands:FindFirstChild("Stand2"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand2"
- end
- elseif randomStand == 3 then
- --Give Stand3
- if Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3") then
- local prevStand = workspace:FindFirstChild(player.Name.." Stand")
- local prev = Backpack:FindFirstChild("Stand1") or Backpack:FindFirstChild("Stand2") or Backpack:FindFirstChild("Stand3")
- prevStand:Destroy()
- prev:Destroy()
- local Stand = Stands:FindFirstChild("Stand3"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand3"
- else
- local Stand = Stands:FindFirstChild("Stand3"):Clone()
- Stand.Parent = Backpack
- currentStand.Value = "Stand3"
- end
- end
- Arrow:Destroy()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment