so i have the model and script and it even shows in my inventory (yk like the 1,2,3 one at the bottom of screen) and when i equip it, nothing shows. i want it to also be able so i can see it in first person on the left side if the screen and not show in the inv but instead already be on the left hand turned on, thanks everyone who helps🙏
#can someone help me with my broken flashlight that i made just now
1 messages · Page 1 of 1 (latest)
do you know what the .Activated method even does 🤦♂️
uh, no thats why im here💀
you're supposed to do .Equipped not .Activated
The difference:
.Equipped: method to check if a tool is equipped
.Activated: method to check if a tool is equipped with mouse being held down on the screen
so do i change it to .equipped
the .Activated method will trigger whenever the player clicks with a tool equipped you were correct, I think the issue is you're trying to set the light to true on the client sided script instead of a server sided one, unless there's an issue with the light itself
well yeah but i want it to be automatic and without it having to show at the bottom just on my left hand
but I was trying to confirm that
would that change anything?
@frail field gave a better explanation
https://create.roblox.com/docs/reference/engine/classes/RemoteEvent look at this here, or look at one of alvinblox's or thedevkings tutorials
yea try script instead of localscript
okk
see if it works
Yea ngl you could probably just copy and paste that code into a server script and it would work
server script storage thats a normal script?
almost
Nope just put a normal script inside the same place you had the local one
** You are now Level 1! **
o alr
And just copy and paste the code into it
whos level 1?
me
try adding print("Equipped") and see if it works
** You are now Level 1! **
if that works then we can continue
after what
Once you activate it in the workspace, click on the flashlight in the explorer and see if it says its enabled, it may be an issue with the light itself, also the print statement ryan said
after the .Equipped event
ok
script.Parent.Equipped:Connect(function()
print("Equipped")
o
tellme if it prints that
if it does then were ontrack
script.Parent.Equipped:Connect(function()
print("equipped")
end) ``` something like that
did it print equipped?
hm instead i got a weird red text
** You are now Level 4! **
Post a pic of it here
show us the script
you put an extra ")"
bru
at the part after printing
oh
show me the code
script.Parent.Equipped:Connect(function()
print("equipped")
end)
script.Parent.Activated:Connect(function()
if script.Parent.Handle.SurfaceLight.Enabled == true then
script.Parent.Handle.SurfaceLight.Enabled = false
else
script.Parent.Handle.SurfaceLight.Enabled = true
end
end) ``` do this
alr
You have an extra end statement in the function so its trying to close 3 functions when you opened 2
replace the old one?
oh
Yep replace all of the old code with that one
ok
script.Parent.Equipped:Connect(function() print("Equipped") if script.Parent.Handle.SurfaceLight.Enabled == true then script.Parent.Handle.SurfaceLight.Enabled = false else script.Parent.Handle.SurfaceLight.Enabled = true end end)
lemme try this
👌
** You are now Level 2! **
isnt this the same one i did?
just try it
Check the explorer after you activate it while still playing
Check if the enabled property is true in the light object it may be the light thats the problem
this script is 100% correct bc i tested it in studio myself
under surface light?
Yep click the surfacelight
ok its my light then
Then check the properties of it
ok
yea
Yep its on its just not showing
i might have to go soon too :/
yeah
When you click the light property does it show that the range of the light is going in a forward direction?
maybe try pointer light
it says its facing right
alr
for flashlight you should do pointlight
yeah no it still imaint budgin
alr
and also put it in workspace and see if it looks good
Yep that should work just put it in the starterpack then test it again, make sure to change the name in the script from surfacelight to pointlight
** You are now Level 2! **
ok
how long have u been scripting btw?
like this
About 5 years now
Yep
dayum
and nothing
i might have to redo everything tmr
cuz imma go to bed
lowkey tired
if yall can maybe help tmr that would be sick
sure
i rly needa learn
thx
can you add me so we can get in contact later
Yessir
i sent h one
** You are now Level 5! **