Im trying to have a Block appear when LePa.CanCollide == true. its not working, heres the script
‘’'local Number = script
local gui = Number.Ending
local LePa = game.Workspace.BrokenParts.LeftPanel
local R1 = game.Workspace.BrokenParts.Rest1
local EG = game.Workspace.BrokenParts.Engine
local RP2 = game.Workspace.BrokenParts.RightPanel2
local SB = game.Workspace.BrokenParts.SeatBack
local OW = game.Workspace.BrokenParts.OverWindow
local RP = game.Workspace.BrokenParts.RightPanel
local CP = game.Workspace.BrokenParts.Computer
local LP2 = game.Workspace.BrokenParts.LeftPanel2
local R2 = game.Workspace.BrokenParts.Rest2
local RW = game.Workspace.BrokenParts.RightWing
local TW = game.Workspace.BrokenParts.TopWing
if LePa.CanCollide == true then
game.Workspace.TEST.Transparency = 0
It could be not working because it’s checking if CanCollide is true before it actually changes. So it could be that when you set it to be true in another script/localscript, it’s doing it after this script checks, thus showing up as false.
The solution in that case would be to use GetPropertyChangedSignal for CanCollide. Here’s, I believe, what you’d want to do:
local Number = script
local gui = Number.Ending
local LePa = game.Workspace.BrokenParts.LeftPanel
local R1 = game.Workspace.BrokenParts.Rest1
local EG = game.Workspace.BrokenParts.Engine
local RP2 = game.Workspace.BrokenParts.RightPanel2
local SB = game.Workspace.BrokenParts.SeatBack
local OW = game.Workspace.BrokenParts.OverWindow
local RP = game.Workspace.BrokenParts.RightPanel
local CP = game.Workspace.BrokenParts.Computer
local LP2 = game.Workspace.BrokenParts.LeftPanel2
local R2 = game.Workspace.BrokenParts.Rest2
local RW = game.Workspace.BrokenParts.RightWing
local TW = game.Workspace.BrokenParts.TopWing
LePa:GetPropertyChangedSignal("CanCollide"):Connect(function()
if LePa.CanCollide == true then
game.Workspace.TEST.Transparency = 0
end
end)
Let me know how it goes!
EDIT: Extra tip. When you format your code on the devforum, don’t use ', use `. It is confusing and it’s not a commonly used key, but for most keyboards the button is right below “esc” and above “tab”.
put it in serverscriptservice and just loop through every part and make a touched event and code inside it but i just recommend you put it in serverscriptservice
That is not true. Scripts within workspace are not limited to running only touched events. Op, the second post should work fine, if that is what you want.
I am working on a game based on an alien planet. The main point of the game is to rebuild your ship and escape. I need the ship to be able to be rebuilt in any order, but any script it try is not working. Here is a video
local Part = workspace.Part
local OtherPart = workspace.OtherPart
local Swap = false
local PlayersOnly = false
if not Swap then
Connection = Part.Touched:Connect(function(hit)
if PlayersOnly then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player ~= nil then
Connection:Disconnect()
OtherPart.Transparency = 0
Part.CanCollide = false
Part.Transparency = 1
end
else
Connection:Disconnect()
OtherPart.Transparency = 0
Part.CanCollide = false
Part.Transparency = 1
end
end)
else
Connection = OtherPart.Touched:Connect(function(hit)
if PlayersOnly then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player ~= nil then
Connection:Disconnect()
Part.Transparency = 0
OtherPart.CanCollide = false
OtherPart.Transparency = 1
end
else
Connection:Disconnect()
Part.Transparency = 0
OtherPart.CanCollide = false
OtherPart.Transparency = 1
end
end)
end