So this is using a dropper I made.
The script is
local function made() local Part = Instance.new("Part") Part.Size = Vector3.new(1,1,1) Part.BottomSurface = 0 Part.TopSurface = 0 Part.Parent = script.Parent Part.Material = ("Neon") Part.Position = script.Parent.Position Part.BrickColor = BrickColor.new("Lime green") Part.CanCollide = true Part.Transparency = 0 Part.Name = "Brick" end while wait(1) do made() end
I want it so when you touch "Brick" you get walkspeed and it disappears
Simply make another function using the Part's Touched event:
brick.Touched:connect(function(hit) --change this directory according to the part local humanoid = hit.Parent:FindFirstChild("Humanoid") -- checks to see if a player touched it if humanoid then humanoid.Walkspeed = 16 -- change walkspeed brick:Destroy() -- or any other means of removing the brick end end)
Hope that helped get you in the right direction.
Hi there! So to make this as simple as possible, So first were gonna use a different setup for a function, in the code i'll label everything that's happening as you read through!
local wSpeed = 18 --This changes the walkspeed to whatever you set it to! local enabled = true script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and enabled == true then -- Checking if humanoid & enabled are true hit.Parent.Humanoid.WalkSpeed = wSpeed -- Sets the walkspeed enabled = false script.Parent.Transparency = 1 -- These 3 lines of code can be changed to a "For" loop to make the transition look nicer wait(3) script.Parent.Transparency = 0 enabled = true -- Simple debounce end end)
The only difference with this script is that your not creating a new part, You can always look into math.random to spawn the "powerup" where ever on your map! Hope this helped you!