Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Click detector not working after doing owner check?

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

6 comments

0

Add a print statement to see what the value of the owner is and what the value of the plr is.

0

Nothing is sending with the prints

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

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

0

print(OwnerValue)

0

nothing is printing when i do that in the scripts

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.