this is a repost because it was flooded out by the problems Roblox had today.
In my game I wanted you to go faster when you touched the baseplate
Script (inside the baseplate):
local part = script.Parent
local num = .05
local CanFire = true
part.Touched:Connect(function(hit)
if CanFire == true then
if hit.Parent:FindFirstChild("Humanoid") then
wait(.1)
hit.Parent.Humanoid.WalkSpeed += num
CanFire = false
wait(.05)
CanFire = true
wait(.1)
end
end
end)
and I added a shop, where you can buy things that cost speed.
here is the script for that (it’s a local script inside starter character scripts):
-- player stuff--------------------
local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
-- player stuff--------------------
-----------GUI buttons---------------------------
local Item1 = game.ReplicatedStorage.ShopItem1GUI
local Item2 = game.ReplicatedStorage.ShopItem2GUI
-----------GUI buttons---------------------------
local ProxPrompt = game.Workspace.Bigtommyboi69.ProximityPrompt
wait(1)
ProxPrompt.Triggered:Connect(function(hit)
------------ITEM 1-------------
Item1.IgnoreGuiInset = false
local Item1 = Item1:Clone()
Item1.Parent = plr.PlayerGui
Item1.ShopItem1GUIimage.MouseButton1Up:Connect(function(hit)
Item1:Destroy()
end)
------------ITEM 1-------------
------------ITEM 2-------------
Item2.IgnoreGuiInset = false
local Item2 = Item2:Clone()
Item2.Parent = plr.PlayerGui
Item2.ShopItem2GUIimage.MouseButton1Up:Connect(function(hit)
hum.WalkSpeed -= 10
end)
------------ITEM 2-------------
end)
so, after you buy something, you speed goes down by 10, but as soon as you take a step or jump, it goes back up to whatever you had before you bought that something.