show me the entire script with the calling of the function, etc and the function itself
Very simple script.
local debounce = false
local tool = script.Parent.Parent
local player = game:GetService("Players").LocalPlayer
local value = script.Parent.Parent:FindFirstChild("Player")
local Debris = game:GetService("Debris")
local function light(glow) --Highlights the hrp
for i = 0,600,1 do
glow.FillTransparency.Value -= .01
task.wait(0.005)
end
for i = 0,600,1 do
glow.FillTransparency.Value += .01
task.wait(0.005)
end
end
tool:WaitForChild("Handle").Touched:Connect(function(hit)
if debounce then return end
-- Will run if the item that touched the handle has a Humanoid
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent.Humanoid
local glow = hit.Parent.glow
debounce = true
print(glow)
light(glow)
humanoid:TakeDamage(15)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = script.Parent.Parent.Parent
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
task.wait(1) -- Change this to how much time the cooldown will take
debounce = false
end)
i reccomend you adding the highlight to the character itself, then sending over the character to the function.
I already added it to the character.
How would I do this?
hold on, is glow the highlight itself?
you would send over the character by simply doing:
light(hit.Parent)
Yep the glow is the highlight, I was too lazy to keep writing it lol.
oh, ignore my other post. is this a local or server script
Server script, is this a problem?
are you combining 2 scripts together in your code because I see this:
game:GetService("Players").LocalPlayer
and also, are you creating the glow highlight on a script, or is it just already there?
The glow is already there. Should I delete and make in the script?
I don’t know what you mean by this…
no you don’t need to make it in a script. i’m still confused on if you’re combining 2 scripts in the code sample
What do you mean by this???
I don’t get this at all…
basically, you’re saying this is a server script. but there is a localplayer variable, which I’m confused about.
Ohh I get this. This was a script from my old game when I was a trash dev and I forgot to take it out. Sorry
alright, are there still the errors there, and can you post your current script.
I already did but I’ll do it again. There are still errors!!!
Code:
local debounce = false
local tool = script.Parent.Parent
local Debris = game:GetService("Debris")
local function light(glow) --Highlights the hrp
for i = 0,600,1 do
glow.FillTransparency.Value -= .01
task.wait(0.005)
end
for i = 0,600,1 do
glow.FillTransparency.Value += .01
task.wait(0.005)
end
end
tool:WaitForChild("Handle").Touched:Connect(function(hit)
if debounce then return end
-- Will run if the item that touched the handle has a Humanoid
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent.Humanoid
local glow = hit.Parent.glow
debounce = true
print(glow)
light(hit.Parent)
humanoid:TakeDamage(15)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = script.Parent.Parent.Parent
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
task.wait(1) -- Change this to how much time the cooldown will take
debounce = false
end)
Error
FillTransparency is not a valid member of Model
local debounce = false
local tool = script.Parent.Parent
local Debris = game:GetService("Debris")
local function light(glow) --Highlights the hrp
for i = 0,600,1 do
glow.FillTransparency.Value -= .01
task.wait(0.005)
end
for i = 0,600,1 do
glow.FillTransparency.Value += .01
task.wait(0.005)
end
end
tool:WaitForChild("Handle").Touched:Connect(function(hit)
if debounce then return end
-- Will run if the item that touched the handle has a Humanoid
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent.Humanoid
local glow = hit.Parent.glow
debounce = true
print(glow)
light(glow)
humanoid:TakeDamage(15)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = script.Parent.Parent.Parent
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
task.wait(1) -- Change this to how much time the cooldown will take
debounce = false
end)
use this, now tell me the other errors when you use this script.
Here we go again… I think this was from before.
attempt to index number with 'Value'