Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Click detector not working after doing owner check?

Asked by 3 years ago

after doing owner checks like theses, the click detector stopped working but no errors print, please someone tell me why?

Putting these two dont make anything different, Its still the same thing to where the click detector isnt working

if plr.Name == OwnerValue then

if plr.Name == OwnerValue.Value then

Script #1

local DropColor = script.Parent.Parent.Parent.Values.DropColor.Value
local Floor = script.Parent.Parent.Parent.MainItems.Floor
local OwnerValue = script.Parent.Parent.Parent.Values.OwnerValue.Value

for i,v in pairs(script.Parent.Buttons:GetChildren()) do
    v.ClickDetector.MouseClick:connect(function(plr)
        if plr.Name == OwnerValue then
            DropColor = v.BrickColor
            script.Parent.Showing.BrickColor = v.BrickColor
            Floor.BrickColor = v.BrickColor
        end
    end)
end

Script #2

local OwnerValue = script.Parent.Parent.Parent.Values.OwnerValue.Value

for i,v in pairs(script.Parent.Buttons:GetChildren()) do
    v.ClickDetector.MouseClick:connect(function(plr)
        if plr.Name == OwnerValue then
            script.Parent.Parent.Parent.Values.MaterialValue.Value = v.Material.Name
            script.Parent.Showing.Material = v.Material.Name
            script.Parent.Parent.Parent.MainItems.Floor.Material = v.Material.Name 
        end
    end)
end
0
Add a print statement to see what the value of the owner is and what the value of the plr is. JustinWe12 723 — 3y
0
Nothing is sending with the prints Chumbis20 6 — 3y
0
What is plr sending and what is OwnerValue sending? If OwnerValue is not sending the name of the owner, then the script that assigned the player name to Ownervalue is where the error is at JustinWe12 723 — 3y
0
well thats the first issue, is that im not to sure on how to print it. Could you please show me how to do that Chumbis20 6 — 3y
View all comments (2 more)
0
print(OwnerValue) tictac67 96 — 3y
0
nothing is printing when i do that in the scripts Chumbis20 6 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

A idea is to not compare the names as it is not the fundamental way to check but compare the userids, According to this script u are the game owner which makes this simple. just basically do this Script: After the mouseclick part

if plr.UserId = game.CreatorId then
-- insert random stuff here

hope this helped -- note i am stupid and lolol pasted this in the wrong channel before pasting it here lul

Ad

Answer this question