Unfortunately, this is really just that…
As an example, I’m trying to find out if “Owner” is equal to the player id. So I put the previous script but it doesn’t work.
I tried when I write my player id instead of plr.UserId, and it works. (Homewer, plr is correct)
ScriptContext? (Server/Local)?? Could you provide console outputs returned by the script? Please provide the entire script and screenshot of the targeted part (including its children)
There is some script before, but I put “prints”, the script stops at plr.UserId.
I correctly identified plr. Its a server script. No errors in console
a little more script:
if target and target:FindFirstChild("Placeable") then
print("placeable")
if target:FindFirstChild("Owner") then
print("Owning")
local Owner = target:FindFirstChild("Owner")
if Owner.Value == plr.UserId then
print("yes")
target:Destroy()
local snap = 1
game.ReplicatedStorage:WaitForChild("PlaceBlockRE").OnServerEvent:Once(function(plr, blockType, target, targetSurface, removeOrPlace)
if removeOrPlace == "placing" then
local position
if targetSurface == Enum.NormalId.Top then
position = target.Position + Vector3.new(0, snap, 0)
elseif targetSurface == Enum.NormalId.Bottom then
position = target.Position - Vector3.new(0, snap, 0)
elseif targetSurface == Enum.NormalId.Left then
position = target.Position - Vector3.new(snap, 0, 0)
elseif targetSurface == Enum.NormalId.Right then
position = target.Position + Vector3.new(snap, 0, 0)
elseif targetSurface == Enum.NormalId.Front then
position = target.Position - Vector3.new(0, 0, snap)
elseif targetSurface == Enum.NormalId.Back then
position = target.Position + Vector3.new(0, 0, snap)
end
local blockInPos
for i, d in pairs(workspace:GetDescendants()) do
if d:IsA("BasePart") and d.Position == position then blockInPos = true end
end
if not blockInPos and position then
local newBlock = blockType:Clone()
local newblockchild = newBlock:GetChildren()
for tablepos,instance in pairs(newblockchild) do
instance.Anchored = true
instance.SelectPart.Transparency = 0.5
instance.Parent.Parent = workspace
newBlock:MoveTo(position)
plr.PlayerGui.BlockPicker.Cancel.Visible = true
plr.PlayerGui.BlockPicker.Confirm.Visible = true
local Owner = Instance.new("StringValue")
Owner.Name = "Owner"
Owner.Value = plr.UserId
Owner.Parent = instance
repeat wait() until
plr.PlayerGui.BlockPicker.Confirm.MouseButton1Click:Once(function()
game.ReplicatedStorage.PlaySoundRE:FireClient(plr)
instance.SelectPart.Transparency = 1
instance.SelectPart.CanTouch = false
instance.SelectPart.CanCollide = false
instance.SelectPart.CanQuery = false
plr.PlayerGui.BlockPicker.Cancel.Visible = false
plr.PlayerGui.BlockPicker.Confirm.Visible = false
script.Disabled = true
script.Disabled = false
end)
plr.PlayerGui.BlockPicker.Cancel.MouseButton1Click:Once(function()
newBlock:Destroy()
plr.PlayerGui.BlockPicker.Cancel.Visible = false
plr.PlayerGui.BlockPicker.Confirm.Visible = false
script.Disabled = true
script.Disabled = false
end)
end
--newBlock.Size = Vector3.new(snap, snap, snap)
end
elseif removeOrPlace == "removing" then
if target and target:FindFirstChild("Placeable") then
print("placeable")
if target:FindFirstChild("Owner") then
print("Owning")
local Owner = target:FindFirstChild("Owner")
if Owner.Value == plr.UserId then
print("yes")
target:Destroy()
game.ReplicatedStorage.PlaySoundRE:FireClient(plr)
script.Disabled = true
script.Disabled = false
else script.Disabled = true
script.Disabled = false
end
else script.Disabled = true
script.Disabled = false
end
end
end
end)
This script work with a local script (local script is total good)
just cause you know what it means doesn’t mean it cant have an error. It could be setting a variable incorrectly or something, we have no way to see what all the variables in this code mean.
Hmm, I know my variables are functional.
For example, if I put my player id in place of “plr.UserId”, it will work. By saying this you will think that plr is therefore wrong, but no because if I enter "print(plr.UserId) it will also work.
Owner is also good, because if I put “print(Owner)” it also gives me the desired value…
(Sorry for the mistakes, I’m French)
Edit:Hum, it’s the lua, the code can turn back on even if it’s disabled
Please try utilizing print(plr.UserId, Owner.Value) after line 110 of the given script to ensure that it matches up.
Line 110: local Owner = target:FindFirstChild("Owner")
In addition, try utilizing print("Checkpoint") after line 115.
Line 115: game.ReplicatedStorage.PlaySoundRE:FireClient(plr)
We want to have further insight to help you as possible.
Try refrain from using .Disabled. It may work, but it may not be a viable option. If it’s done correctly, then it will work. If it doesn’t work, something is wrong. You may seek return as a possible alternative.
In addition, is Owner a StringValue or NumberValue?