#Model cloning

1 messages · Page 1 of 1 (latest)

mental stone
#

im relativley new to roblox studio, i changed my script around so that i dont have to script each parts elements induvidually. However, now it wont let me set the position to the players position, why?

local playerpos = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.Position
local juicecount = 0
local juicescript = workspace.Juicescript
local debounce = false
local GrapejBase = workspace.Grapejuice

uis.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        if debounce then return end
        debounce = true
        if juicecount < 2 then
            local grapejuice = GrapejBase:Clone()
            local juiceclone = juicescript:Clone()
            juiceclone.Enabled = true
            grapejuice.Parent = workspace.juices
            juiceclone.Parent = grapejuice
            juicecount = juicecount + 1
            print(juicecount)
            wait(10)
            debounce = false
        end
    end
end)```
#

im aware this scripts probably unoptimized as hell lol

#

it does clone the model and add the script under it, but wont set the position if i add
grapejuice.Position = Vector3.new(playerpos.x, 0.106, playerpos.z)

#

it did before i made it clone rather than create

#

Ping me if i go unresponside

spice badge
mental stone
#

the script is meant to be an ability of a character

#

it just creates a model of the juice they spill

#

but it spawns at the position of the original model

weak tangle
spice badge
#

its cause ur getting the position at the start and the character probably hasnt even loaded in yet

#

ur not even changing the position of the model

#

and why r u cloning 2 things

mental stone
#

thats what the issue is

mental stone
#

wdym

weak tangle
#

like

#

your script

#

loading faster than character itself

mental stone
#

it worked perfectly before i made it clone instead of induvidually make the parts

weak tangle
#

oh also i see you cloning script

#

instead of clonning it you can add script as child in fruit

#
local uis = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrt = char:WaitForChild("HumanoidRootPart")
local juicecount = 0
local debounce = false
local GrapejBase = workspace:FindFirstChild("juices"):WaitForChild("Grapejuice")

uis.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        if debounce then return end
        local playerpos = hrt.CFrame.Position
        debounce = true
        if juicecount < 2 then
            local grapejuice = GrapejBase:Clone()
            grapejuice.Parent = workspace:FindFirstChild("juices")
            juicecount = juicecount + 1
            print(juicecount)
            wait(10)
            debounce = false
        end
    end
end)
near fiber
#

@mental stone

#

Do like this

#
local Repstore = game:getService("ReplicatedStorage")
local Part = Repstore.Part

local ClonePart = PartClone
ClonePart.Parent = worspace
mental stone
#

that wont set the postion