You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to replace a button when a player dies, so that when he/she plays again, he/she can step on the button again.
What is the issue? Include screenshots / videos if possible!
I can’t seem to replace the buttons when the player dies.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried remote events, functions, and tried making a folder with replacement buttons when a player dies so I can clone it and place it in the last button’s parent.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Code involving the buttons:
local player = game.Players.LocalPlayer
local button1 = workspace.Tower1.WIP.Button1
local button2 = workspace.Tower1.WIP.Button2
local button3 = workspace.Tower1.WIP.Button3
button1.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
local wall = workspace.Tower1.WIP.Wall1
wall.Transparency = 0.75
wall.CanCollide = false
button1.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)
button2.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
local wall = workspace.Tower1.WIP.Wall2
wall.Transparency = 0.75
wall.CanCollide = false
button2.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)
button3.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
local wall = workspace.Tower1.WIP.Wall3
wall.Transparency = 0.75
wall.CanCollide = false
button3.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)
Ok so this is my new code, but it still doesnt work! By the way, I placed the local script into the starter gui.
local player = game.Players.LocalPlayer
local button1 = workspace.Tower1.WIP.Button1
local button2 = workspace.Tower1.WIP.Button2
local button3 = workspace.Tower1.WIP.Button3
local wall1 = workspace.Tower1.WIP.Wall1
local wall2 = workspace.Tower1.WIP.Wall2
local wall3 = workspace.Tower1.WIP.Wall3
wall1.Transparency = 0
wall1.CanCollide = true
wall2.Transparency = 0
wall2.CanCollide = true
wall3.Transparency = 0
wall3.CanCollide = true
button1.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
wall1.Transparency = 0.75
wall1.CanCollide = false
button1.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)
button2.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
wall2.Transparency = 0.75
wall2.CanCollide = false
button2.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)
button3.ButtonPart.Touched:Connect(function(hit)
if player.Character and hit:IsDescendantOf(player.Character) then
wall3.Transparency = 0.75
wall3.CanCollide = false
button3.ButtonPart.BrickColor = BrickColor.new("Bright red")
end
end)