My weird beginner script won't work

I don’t get why this script doesn’t work. Im just starting to get into scripting.

local player = game.Players.LocalPlayer
local eq = player.script.parent.Equipped

if eq = true then
Connect:(function()
script.Parent.Handle.Trail.Enabled = true
if script.Parent.Handle.Trail.Enabled == false then
Connect:(function()
end
script.Parent.handle.Trail.Enabled
end)
end

Link To Code: LocalScript help pls - Roblox

.Equipped isn’t a bool, it’s a function.

This kind of confused me, you can just place this script inside the tool

-- Script inside tool

local player = game:GetService('Players').LocalPlayer

script.Parent.Equipped:Connect(function()
    script.Parent.Handle.Trail.Enabled = true
end)

script.Parent.Unequipped:Connect(function()
    script.Parent.Handle.Trail.Enabled = false
end)
2 Likes

When doing if statements, you have to add •
“==“ if you trying to tell the script if this and that is equal to.

Connect:(function() is undefined, you have to put together the event instead of calling it in a variable. I don’t think the script knows where “player” is,

Overall way too many errors for me to explain to you at the moment. And it looks like your trying to make a trail of some sort?

True, lots of errors. It is fine having even 1000 errors as you know the quote “Everyone makes mistake.”

The most clear one is the two forgotten equal signs.

EVERY TIME ALMOST WHEN YOUR DOING A IF STATEMENT DO TWO EQUALS.

Also Connect:function() is a nil value. You have to put together the event instead of making it like that. Also, I would watch youtube tutorials.

No hate to you, but think of it like help for your scripting.

My reply was decided 6 months ago. I appreciate your criticism, since I still don’t know when to explain what is nil or undefined. But is the ‘watch more YouTube videos’ really necessary since ive been getting better with Luau over that many months :thinking:

At the time I made the post, I didn’t have lots of time on my hand. If I did, I would likely help correct him with the rest of the errors.

Well, I mean I would of helped if i could but it’s literally 9pm here so I can’t. But if you don’t get what nil is it basically is that it doesn’t exist or doesnt consist of a value. I mean I’m just suggesting that watching more yt videos are better as it is a way to learn roblox scripting. When, it returns a unknown value, it’s nil.

If you need any scripting help, just tell me. I know I’m pretty late.

how is this even relevant :rofl:
bro this is so easy for me now

1 Like