#Welding Item to wrist after proximity prompt

1 messages · Page 1 of 1 (latest)

icy sable
#

local plr = game:GetService("Players")
local runservice = game:GetService("RunService")
local ServerStorage = game:GetService("ServerStorage")

local function WeldOmnitrix(plr)

plr.CharacterAdded:Connect(function()
    wait()
    
    local char = ServerStorage.WeldRig
    
    local Omnitrix = ServerStorage.OmnitrixWeld.OmniBand:Clone()
    local PosRef = ServerStorage.OmnitrixWeld.anchorpoint:Clone()
    local LeftLowerArm = char.LeftLowerArm
    
    Omnitrix.Parent = char
    Omnitrix.anchorpoint:PivotTo(plr.LeftLowerArm.CFrame)
    
    local weld = Instance.new("WeldConstraint", Omnitrix)
        weld.Part0 = LeftLowerArm
        weld.Part1 = Omnitrix.anchorpoint    
    
if game.Workspace["The Omnitrix"].Main.ProximityPrompt.Triggered then

WeldOmnitrix()
    
end
    
end)

end

I am very new to coding tbh and while ive looked up tutorials and browsed several documents on this stuff for the life of me i cant get it to actually do the thing (for the record the proximity promp is on a free floating model and I anchored a small object to a model that I put into Server Storage) If i could get some help or advice id greatly appreciate it

rustic falcon
#
local function WeldOmnitrix(plr)

    plr.CharacterAdded:Connect(function()
        wait()

        local char = ServerStorage.WeldRig

        local Omnitrix = ServerStorage.OmnitrixWeld.OmniBand:Clone()
        local PosRef = ServerStorage.OmnitrixWeld.anchorpoint:Clone()
        local LeftLowerArm = char.LeftLowerArm

        Omnitrix.Parent = char
        Omnitrix:PivotTo(plr.LeftLowerArm.CFrame)

        local weld = Instance.new("WeldConstraint", Omnitrix)
            weld.Part0 = LeftLowerArm
            weld.Part1 = Omnitrix.anchorpoint

        if game.Workspace["The Omnitrix"].Main.ProximityPrompt.Triggered then
            WeldOmnitrix()
        end

    end)
end
rustic falcon
#

are you running your function in the first place

#

second of all, how you coded it will cause a memory leak

#

as your doing the player CharacterAdded connection over and over again

icy sable
#

I assumed WeldOmnitrix() was a call for the function

rustic falcon
#

inside the function

#

Look, you have alot of problems

#

So lets fix em 1 by one

icy sable
#

lol yea i assumed

rustic falcon
#

First of all, you need to remove the plr.CharacteraddedConnection from the function

#

Wait

#

before you do so

#

Could you show a sample of the rest of the code if you have any

#

?

icy sable
#

thats all of it so far I wanted to get the thing on the character before i tried anything else

rustic falcon
#

So basically

#
SPlayer = game:GetService("Players")
--getting the players services

local function weld()
  --Your weld function here
end

SPlayer.PlayerAdded:Connect(function(Plr) 
  --Detect when player joins
  Plr.CharacterAdded:Connect(function(Character) 
    --Detect when character actually spawns in game

     game.Workspace.ProximityPrompt.Triggered:Connect(function()
       --This is how you should detect if the proximity prompt is triggered
       weld()
     end)
  end)
end)
#

I hope you understand the general idea

#

In the weld function you'll just do your weld logic

#

and run the function in the character added connection

icy sable
#

so i would put the if then for proximityprompt under character added connection?

rustic falcon
#

Thats not how you detect if proximity prompt is triggered

#

I edited the code above

icy sable
#

ohhh

#

cuz i set like a test to see if the prompt was working and it wasnt i see

wraith rootBOT
#

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

rustic falcon
#

Thats if you write the rest of the code correctly

#

finish writing it up, if you find any errors ping me and I'll help you out

icy sable
# rustic falcon finish writing it up, if you find any errors ping me and I'll help you out

local plr = game:GetService("Players")

local ServerStorage = game:GetService("ServerStorage")

local function WeldOmnitrix()

    local char = ServerStorage.WeldingRig
    
    local Omnitrix = ServerStorage["The Omnitrix"]:Clone()
    local LeftLowerArm = char.LeftLowerArm
    
    Omnitrix.Parent = char
    Omnitrix:PivotTo(plr.LeftLowerArm.CFrame)
    
    local weld = Instance.new("WeldConstraint", ServerStorage["The Omnitrix"].Main)
        weld.Part0 = Omnitrix
        weld.Part1 = workspace.WeldingRig.anchorpoint

end
plr.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()

    game.Workspace["SpawnerTrix"].Main.ProximityPrompt.Triggered:Connect(function()
            WeldOmnitrix()
    end)
end)

end)

It def tries to run it but it just isnt showing up on my model, sorry this coding stuff just isnt making sense to me quite yet

#

i get

Stack Begin - Studio
23:29:10.393 Script 'ServerScriptService.Omniweld Script', Line 16 - function WeldOmnitrix - Studio - Omniweld Script:16
23:29:10.393 Script 'ServerScriptService.Omniweld Script', Line 28 - Studio - Omniweld Script:28
23:29:10.393 Stack End

so i believe that shows its calling the function but i think either the tutorials im seeing arent exactly useful for what im doing or maybe i got something wrong somewhere

rustic falcon
# icy sable local plr = game:GetService("Players") local ServerStorage = game:GetService("S...
local plr = game:GetService("Players")

local ServerStorage = game:GetService("ServerStorage")


 
local function WeldOmnitrix(plr)


        local char = ServerStorage.WeldingRig

        local Omnitrix = ServerStorage["The Omnitrix"]:Clone()
        local LeftLowerArm = char.LeftLowerArm

        Omnitrix.Parent = char
        Omnitrix:PivotTo(plr.LeftLowerArm.CFrame)

        local weld = Instance.new("WeldConstraint", ServerStorage["The Omnitrix"].Main)
            weld.Part0 = Omnitrix
            weld.Part1 = workspace.WeldingRig.anchorpoint


end
plr.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function()

        game.Workspace["SpawnerTrix"].Main.ProximityPrompt.Triggered:Connect(function()
                WeldOmnitrix(plr)
        end)
    end)
end)
#

You forgot to send in the plr as a parameter

icy sable
#

still nothin i wonder if its a problem with the model i found or the way i set up the weld?

icy sable
#

for the record im using R15

icy sable
# rustic falcon <@1195990110676725760> try this

local plr = game:GetService("Players")

local ServerStorage = game:GetService("ServerStorage")

local function WeldOmnitrix(plr)

local char = plr.Character

local Omnitrix = ServerStorage["The Omnitrix"].Main:Clone()
local LeftLowerArm = char.LeftLowerArm

Omnitrix.Parent = char
Omnitrix:PivotTo(LeftLowerArm.CFrame)

local weld = Instance.new("WeldConstraint", Omnitrix)
weld.Part0 = LeftLowerArm
weld.Part1 = Omnitrix

end
plr.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()

    game.Workspace["SpawnerTrix"].Main.ProximityPrompt.Triggered:Connect(function()
        WeldOmnitrix(plr)
    end)
end)

end)

I got it to work but the only problem is it seems to prevent my character from moving

#

i figured out the rest is just an issue with welding some parts together Thanks a ton!

rustic falcon
icy sable
rustic falcon
#

they allow for you to connect between to in game parts

#

but they also allow for animations

rustic falcon
#

Like any animation in general which includes more than the character parts

icy sable
wraith rootBOT
#

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

rustic falcon
icy sable
#

I have a small block welded to the character arm and the item weled to that block but it doesnt seem to stick

rustic falcon
#

Check the Part0

#

if you trying to weld em to the character

#

just set part 0

#

to the same character part

#

and part1, to the part itself

icy sable
#

so part 0 would be the arm and part 1 the block?

#

cuz i mostly just need an animation of the dial coming up on a button press but it would look very good if the dial falls off all the time lol

#

alr i got it and could i just code an instance for motor6d similar to the weld code from above? ig im confused on how the animation will transfer to the player

rustic falcon
#

and it should replicate

#

if your using motor6D

#

and did the naimg correctly

rustic falcon
#

You might want to edit the C0 or C1 properties

#

to position the parts in a certain way

icy sable
#

ok i still havent researched it enough but so far im tryna figure out why the stick and dial dont stay attatched to my player once i initiate the code you helped me with they both apper but they dont stick to my players arm

icy sable
#

local plr = game:GetService("Players")

local ServerStorage = game:GetService("ServerStorage")

local function WeldOmnitrix(plr)

local char = plr.Character

local Omnitrix = ServerStorage["The Omnitrix"].Main:Clone() --[[clones the Main inside  The Omnitrix  I welded every part 
of the model to the main, though to animate the Dial gonna have to swap the dials WeldConstraint to Motor6d]]
local LeftLowerArm = char.LeftLowerArm

Omnitrix.Parent = char
Omnitrix:PivotTo(LeftLowerArm.CFrame)

local weld = Instance.new("WeldConstraint", Omnitrix)
weld.Part0 = LeftLowerArm
weld.Part1 = Omnitrix

end
plr.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()

    game.Workspace["SpawnerTrix"].Main.ProximityPrompt.Triggered:Connect(function()
        WeldOmnitrix(plr)
    end)
end)

end)

#

this is the only code ive got rn ive got the dial and stick its attatched to within The Omnitrix so it instances and I have WeldCOnstraints connecting the stick to the dial and the stick to the arm

rustic falcon
#

bro you never parented the weld ot the player 👀

#

or wait

#

nvm

#
weld.Part1 = Omnitrix.PrimaryPart
#

Try this

icy sable
#

no that just makes thing fall off my arm

#

i think somethings gotta be anchored where it shouldnt be cuz it just floats there

rustic falcon
#

it should not work

icy sable
#

that part welds what i want it to to the character its just the dial that has motor6d that doesnt connect for some reason

#

alr i found the stick i was using was anchored so now it falls through the floor but I think for whatever reason the motor6d that i set to connect the stick and the arm isnt connecting, properly

rustic falcon
#

show the properties?

#

of your motor6d

icy sable
rustic falcon
#

Like are you even setting the part0 and part1

#

tf

#

thats weird

icy sable
#

yea im not sure maybe if i put motor6D into LowerLeftArm?

rustic falcon
#

Try it

icy sable
#

no ive tried that and weldConstruct LeftLowerArm to DialStick and motor6d DialStick and Core Main but it just keeps falling

rustic falcon
#

there might me people who can help you with that problem

icy sable
#

i think ill prob skip trying to make the dial pop up so i can start working on the transformation mechanics but i might come back to it if motor6d gives me problems on stuff that are harder to ignore lol ty for all the help