#This event is not working, have tried everything to fix it with Google Gemini

27 messages · Page 1 of 1 (latest)

molten moat
#

I can't send the whole lua code because of discord message limit : (

#

How this event works?
step1: Clones HEsHEre part (ServerStorage > Entities > HEsHEre)
step2: Put the cloned one into workspace
step3: Teleport to random position (minXpos: -164 maxXpos: 215) (minYpos: 1 maxYpos: 181) (minZpos: -186 maxZpos: 205)
step4: Check if the player stares at it under 6 seconds
step5: If the play doesn't stare at it and 6 seconds is over, the graphics will turn into red then makes kill sound then the player dies and gets kicked with message "DId YOu SEe mE?"
step6: If the player looked at the entity, the game will turn into red for 1 second and sound plays then the entity disappears (delete cloned entity) and graphics turns back to normal.

swift portal
#

Is the event firing and not doing anything? Is it doing something but not what you want?

molten moat
#

it is launched by EventManager, also i can fire it though developer console

wraith bronzeBOT
#

studio** You are now Level 1! **studio

molten moat
#

step 4 to 6 is not working

swift portal
molten moat
#

i dont see any errors or warnings

#

this is so strange

swift portal
#

Okay, show me just part 4 code.

molten moat
#

the camera detection

#
    while tick() - startTime < 6 do
        task.wait(0.1)

        local camera = workspace.CurrentCamera
        local entityPosition = clonedEntity.Position
        local cameraPosition = camera.CFrame.Position
        local direction = (entityPosition - cameraPosition).Unit * 10000 --Increased raycast length

        local raycastParams = RaycastParams.new()
        raycastParams.FilterDescendantsInstances = {player.Character, clonedEntity}
        raycastParams.FilterType = Enum.RaycastFilterType.Exclude

        local raycastResult = workspace:Raycast(cameraPosition, direction, raycastParams)

        print("Raycast Origin: ", cameraPosition)
        print("Raycast Direction: ", direction)
        print("Direction X: ", direction.X, "Y: ", direction.Y, "Z: ", direction.Z) -- Print direction components
        print("Entity Position: ", entityPosition)
        print("Camera Position: ", cameraPosition)
        print("Camera LookVector: ", camera.CFrame.LookVector)
        if raycastResult then
            print("Raycast Hit: ", raycastResult.Instance)
        else
            print("Raycast Hit: nil")
        end

        if raycastResult and raycastResult.Instance == clonedEntity then
            playerLooked = true
            break
        end
    end

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local CameraEffectEvent = ReplicatedStorage:WaitForChild("CameraEffect")

    if playerLooked then
        -- Player looked at the entity
        CameraEffectEvent:FireClient(player)
        clonedEntity:Destroy()
    else
        -- Player did not look at the entity
        CameraEffectEvent:FireClient(player)
        -- Play kill sound here.
        local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
        if humanoid then
            humanoid.Health = 0;
        end
        player:Kick("DId YOu SEe mE?")
        clonedEntity:Destroy()
    end
#

should i show you how it behaves? (in vc)

swift portal
molten moat
#

i dont even know, this whole event was coded by google gemini.

#

when i look at the entity directly, the Raycast hit keeps saying Barrier instead of entity part "HEsHEre"

swift portal
molten moat
#

i told Gemini the problem, also it created 12 events sucessfully without any errors being unfixable

molten moat
#

: (

wraith bronzeBOT
#

studio** You are now Level 2! **studio

swift portal
molten moat
#

but it seems to be hard to learn because i also have understanding disorder

swift portal
molten moat
#

well atleast the AI coded 12 events that work successfully, but coding this kind of event (like HEsHEre event) needs human to do it.