local shopPart = game.Workspace.Part
local closeMenu = game.Workspace.closePart
local shopMenu = script.Parent
local function open(bodyPart)
local humanoid = bodyPart.Parent:FindFirstChild('Humanoid')
if humanoid then
shopMenu.Visible = true
end
end
local function close(bodyPart)
local humanoid = bodyPart.Parent:FindFirstChild('Humanoid')
if humanoid then
shopMenu.Visible = false
end
end
shopPart.Touched:Connect(open)
closeMenu.Touched:Connect(close)
local Button1 = script.Parent
local part = game.Workspace.Part
local BOOSTED_JUMP_POWER = 200
local buy = false
local function item1()
if buy == false then
buy = true
else
buy = false
end
end
local function give(bodyPart)
local humanoid = bodyPart.Parent:FindFirstChild('Humanoid')
if humanoid and buy then
local currentJumpPower = humanoid.JumpPower
if currentJumpPower < BOOSTED_JUMP_POWER then
humanoid.JumpPower = BOOSTED_JUMP_POWER
wait(10)
humanoid.JumpPower = currentJumpPower
buy = false
end
end
end
Button1.MouseButton1Click:Connect(item1)
part.Touched:Connect(give)
local Button2 = script.Parent
local speedPart = game.Workspace.Part
local BOOSTED_SPEEED_POWER = 200
local buy = false
local function item2()
if buy == false then
buy = true
else
buy = false
end
end
local function give(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid and buy then
local currentSpeed = humanoid.WalkSpeed
if currentSpeed < BOOSTED_SPEEED_POWER then
humanoid.WalkSpeed = BOOSTED_SPEEED_POWER
wait(10)
humanoid.WalkSpeed = currentSpeed
buy = false
end
end
end
Button2.MouseButton1Click:Connect(item2)
speedPart.Touched:Connect(give)
local Button3 = script.Parent
local part = game.Workspace.Part
local buy = false
local function item3()
if buy == false then
buy = true
else
buy = false
end
end
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChild("Humanoid")
if humanoid and buy then
-- Set player's health to 0
humanoid.Health = 0
buy = false
end
end
part.Touched:Connect(onPartTouch)
Button3.MouseButton1Click:Connect(item3)
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 50
gold.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)