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

Color3Value not changing when touching parts?

Basically when you touch a part in the workspace a brickColorValue in this script changes into the part you touched. But for some reason This script isn't acting right.. Here is the script

p = script.Parent.Parent
c = p.Character
mouse = p:GetMouse()
hold = false
color = false
function color(hit)
	color = true
	for i,v in pairs(hit.Parent:GetChildren()) do
		wait()
		if v:IsA("Part") and color == true then
			script.Debris.Value = v.BrickColor
					end
		end
	end

function charge(key)
	key:lower()
	if key == "z" then
		hold = true
		game:GetService("Chat"):Chat(c.Head,"Haaa..!!!")
		script.aura:Clone().Parent = c.Head
		while hold == true do
			wait()
			h = Instance.new("Part",game.Workspace)
			h.BrickColor = script.Debris.Value
			h.TopSurface = "Smooth"
			h.BottomSurface = "Smooth"
			h.CanCollide = false
			g = Instance.new("BodyVelocity",h)
			h.Size = Vector3.new(math.random(1,5),.4,math.random(1,3))
			h.CFrame = c.Torso.CFrame*CFrame.new(math.random(-1.75,2),-3,1.5)
			h.CFrame = h.CFrame*CFrame.fromEulerAnglesXYZ(math.random(1,5),math.random(1,3),math.random(1,2))
			g.maxForce = Vector3.new(0,math.huge,0)
			g.P = 0
			g.Velocity = Vector3.new(0,16,0)
			wait(.5)
			h:Destroy()
		end
	end
end

function nocharge(key)
	key:lower()
	if key == "z" then
		hold = false
		c.Head.aura:Destroy()
		color = false
		script.Disabled = true
		wait(.15)
		script.Disabled = false
	end
end

c["Right Leg"].Touched:connect(color)
mouse.KeyDown:connect(charge)
mouse.KeyUp:connect(nocharge)

1 answer

✓ Accepted answer

There are multiple errors in both the script and the question you have posted. I will not be supplying a script, as I haven't a clue as to what you're trying to accomplish as you gave very-little to no detail or information as to what your script does. I'm assuming you're using a deprecated type of key-detection, which is frowned upon. UserInputService is highly recommended for this, and a lot easier to use.

I would throw in a few WaitForChild as it will most likely help you with your issue.

Just a tip, most scripters aren't going to know the error if you don't copy and paste the error in the output.

2 comments

0

Heres another tip,There are no errors in the output and wtf -3??Why?!?

0

I didn't give you the -3, I gave you a realistic answer. And I'm calling lies on the output, considering I see five issues.

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