Hi! I need help setting a weld constraint part1 to nil. I have a script that changes part 1 to nil and when I add a print function in the script it prints as part 1 being nil, when really it is not.
Server Script:
local playerConstraint = LuckyBlock.Main.PlayerConstraint
playerConstraint.Part1 = nil
print(playerConstraint.Part1)
for i, v in pairs(LuckyBlock:GetChildren()) do
if v:IsA("MeshPart") then
v.CFrame = script.Parent.Holder.CFrame
v.Anchored = true
end
end
Wait I might have responded wrong. When the remote event fires it does get to the part where it anchored the blocks but the code is:
local UIS = game:GetService("UserInputService")
local main = script.Parent.Main
local RepStore = game:GetService("ReplicatedStorage")
local onPc = script.Parent.OpenerGui.OpenerButton:GetAttribute("OnPcValue")
local processed = script.Parent.OpenerGui.OpenerButton:GetAttribute("Processed")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if (UIS.KeyboardEnabled) then
print("Player Has Keyboard")
script.Parent.OpenerGui.OpenerButton:SetAttribute("OnPcValue", true)
script.Parent.OpenerGui.Parent = game.StarterGui
script.Parent.RemoteHandler:FireClient(player, script.Parent)
print("Fired")
else
script.Parent.OpenerGui.OpenerButton:SetAttribute("OnPcValue", false)
script.Parent.OpenerGui.Parent = game.StarterGui
script.Parent.RemoteHandler:FireClient(player, script.Parent)
print("Fired")
end
script.Parent.RemoteHandler.OnServerEvent:Connect(function(player)
local hrp = char.HumanoidRootPart
local LuckyBlock = char:WaitForChild("LuckyBlock")
local opened = LuckyBlock:GetAttribute("Opened")
local equipped = LuckyBlock:GetAttribute("Equipped")
local playerConstraint = LuckyBlock.Main.PlayerConstraint
playerConstraint.Part1 = nil
print(playerConstraint.Part1)
for i, v in pairs(LuckyBlock:GetChildren()) do
if v:IsA("MeshPart") then
v.CFrame = script.Parent.Holder.CFrame
v.Anchored = true
end
end
end)
end)
end)