#bug?

1 messages · Page 1 of 1 (latest)

gilded spade
#

It seemed that the flashlight collides, although all collision is deactivated

#

this is the flashlight

runic dove
gilded spade
runic dove
gilded spade
#

atleast the models, they r collide false

#

some guy helped me doing this so, the scripts idk

runic dove
# gilded spade

that looks like normal character collision except your camera is messed up a bit

#

it looks like you have a custom camera

gilded spade
#

is not messed is FP

#

😭

runic dove
#

unequip the torch and see if it still happens, please do show recording of this

runic dove
gilded spade
runic dove
#

er, except maybe adding a pointlight nearby to see whats going on

runic dove
runic dove
# gilded spade

also that is in replicatedstorage. that is not the flashlight in your character's hands.

gilded spade
#

lighting is the model for the flashlight, he made a script to tp it to the hands i think, for the animation, the handle i think is decorative

#

lightbone is the ring i supose

runic dove
#

check it while the game is running.

gilded spade
#

yes, it is

#

its the light

#

when i run the game that model is created

gilded spade
runic dove
gilded spade
runic dove
gilded spade
#

k

runic dove
#

tho i'm guessing you took this from the server view? it needs to be checked on the client coz if any collisions happening there, that's what is going to mess with your camera, if anything.

runic dove
gilded spade
#

thats server side, yes. to see how the flashlight collides with the wall. but in client its the same

gilded spade
#

so is only the flashlight there

#

if u want i can send u the scripts

runic dove
gilded spade
# gilded spade .

in the first pic looks like it collides, cuz the invisible flashlight is watching the left

gilded spade
#

i can look for a model in models, and put the tool in the starterpack

gilded spade
gilded spade
# gilded spade .

when i run the game, the invisible flashlight goes to my camera like in that image, and as u can see, is like it collides, so the problem is this model, only this

#

want to see the scripts?

runic dove
#

working as expected

gilded spade
# gilded spade .

Thinking deeper, i gonna see if this is anchored, if it is, so maybe is there any form to make it always be like the second image, right?

runic dove
gilded spade
#

Alr but is not answering

#
local User_Input_Service = game:GetService("UserInputService") 
local Run_Service = game:GetService("RunService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character
local Player_GUI = player.PlayerGui
local Mobile_Button = Player_GUI:WaitForChild("MobileButton").Frame.Flashlight

local Mobile = User_Input_Service.TouchEnabled

local Camera = workspace.CurrentCamera
local Mouse = player:GetMouse()

local Events = Replicated_Storage.Remotes.Events
local Flashlight_Event = Events.Flashlight_Toggle
local Replicate_Event = Events.Flashlight_Replicate

local Flashlight_Activated = false
local playing = false

local animation = script:WaitForChild("Animation")
local animTrack : AnimationTrack = character.Humanoid:LoadAnimation(animation)
animTrack:GetMarkerReachedSignal("Activate"):Connect(function()
    animTrack:AdjustSpeed(0)
end)
local Flashlight_Debounce = false

local function Toggle_Flashlight()

    if Flashlight_Debounce then return end
    Flashlight_Debounce = true

    Flashlight_Activated = not Flashlight_Activated

    if playing then
        animTrack:AdjustSpeed(1)
        animTrack:Stop()
    else
        animTrack:Play()
    end

    playing = Flashlight_Activated

    Flashlight_Event:FireServer(Flashlight_Activated)

    task.delay(0.6,function()
        Flashlight_Debounce = false
    end)
end



User_Input_Service.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    if input.KeyCode == Enum.KeyCode.F or input.KeyCode == Enum.KeyCode.ButtonR3 then
        Toggle_Flashlight()
    end
end)


Mobile_Button.Activated:Connect(Toggle_Flashlight)
#
local Frame = 0
Run_Service.RenderStepped:Connect(function()
    local Target_Position = Mouse.Hit.Position
    local Right_CFrame : CFrame = character.Head.CFrame * CFrame.new(1.5,0,-1.5)

    if Mobile then
        local Params = RaycastParams.new()
        Params.FilterDescendantsInstances = {character}
        Params.FilterType = Enum.RaycastFilterType.Exclude

        local Ray_Results = workspace:Raycast(character.Head.Position,Camera.CFrame.LookVector*100,Params)
        if not Ray_Results then
            Target_Position = Right_CFrame.Position + Camera.CFrame.LookVector*2
        else
            Target_Position = Ray_Results.Position
        end
    end

    Light_Bone.PrimaryPart.CFrame = CFrame.lookAt(Right_CFrame.Position, Target_Position)
    Frame += 1
    if Frame >= 5 then
        Replicate_Event:FireServer(Light_Bone.PrimaryPart.CFrame)
        Frame = 0
    end
end)```
#

if u want to see it this is the entire code

#

If not I will have to do that I do later

#

Anyway thanks

runic dove
# gilded spade Alr but is not answering
Run_Service.RenderStepped:Connect(function()
    local Target_Position = Mouse.Hit.Position```
the fact that there's a raycast being used in this code suggests it is your code that is 'colliding', not the flashlight.
gilded spade
#

How can i solve it

runic dove
#

Light_Bone.PrimaryPart.CFrame = CFrame.lookAt(Right_CFrame.Position, Target_Position) shows usage of the raycast

runic dove
#

the hit position is behind where the light parts are in this collision situation where the light parts are through a wall but your mouse ray is hitting the wall, so it is facing backwards because of the cframe.lookat

gilded spade
#

The flashlight tool wasnt doing this cuz is a part with spotlight, not a raycast or smt like this, right?

runic dove
#

why does the flashlight need to reposition the light every frame? that's dum

gilded spade
#

Oh cuz i have a script for first person, so o missunderstanded

runic dove
gilded spade
runic dove
#

or all this lightbone and lightpart shenanigans

#

just weld the darn thing

#

though i guess, you do wanted pointed in your camera's direction thonkoof

gilded spade
#

Dude

#

What r u saying

runic dove
#

...so then weld it to the camera lol duh

gilded spade
#

Is the same that he said about the flashlight model i had "the dude that did this is dumb"

#

This flashlight is a bucle of errors and fixes

runic dove
#

and just beg people for help over and over and you end up with worse than a copy of a copy of a copy.

#

some people develop that way, please don't be one of them

#

chatgpt goes the same way

gilded spade
#

No no like i did it by myself, i tried for hours

#

But as a non scripter is crazy to do it

runic dove
#

or you can weld it to the flashlight

#

they have slightly different results but both will stop it deflecting and pointing behind you in collision situation

gilded spade
zenith kelpBOT
#

studio** You are now Level 8! **studio

runic dove
#

or change the lookat to instead point in the camera's direction instead of towards the mouse hit position

#

3 different solutions, each have their niche pros and cons ;p

gilded spade
runic dove
runic dove
#

using cframe.lookalong + mouse direction vector like currentcamera.lookvector instead of cframe.lookat + mouse hit position

gilded spade
#

Ngl i ever cant make a part anchor with code, but i understand a little little bit, im cooked

#

THANK YOU

#

I CHANGED IT

#

war is fking over

runic dove
# gilded spade war is fking over

nah its still a fair bit of a bandaid on top of what is probably already another bandaid because you have an entirely different raycast in there for mobile so it will probably look different. battle is over, but not the war.

gilded spade
#

in mobile is the same, It is supposed, but not for the ring

#

mobile was working well but withouth ring and they cant see their own body

runic dove
# gilded spade I CHANGED IT

still, i'm glad you know enough to take that basic direction and apply it. pretty simple change, but many beginners wouldn't understand how to do that ;p

gilded spade
#

when im mean im new, is for real

#

but i can understand a little bit codes for watching them

#

this week i learnt a lot

runic dove
gilded spade
#

i need to learn a lot a lot a lot

#

for this game

runic dove
gilded spade
runic dove
#

specially if you keep this up

gilded spade
#

triggers, events, for the game, and more

runic dove
gilded spade
#

gonna take months to learn properly

#

so, lets work