Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Model Screwed up after cloning, help?

Asked by 4 years ago

hey everyone. so i setup a basic concept which should be as follows. i've setup an NPC with an dialog which works. the NPC has no script due the script won't run no matter how i would place it. so the script is now put under the starterpack so it will be loaded client sided and now the script works using the following code

print("Initiating Ship Broker Script")
workspace["Ship Broker"].Head.Dialog.DialogChoiceSelected:connect(function(player,choice)
    print("Executing Dialog Choice")
    local stats = player.leaderstats
    if not stats then return end
    local gold = stats:FindFirstChild('Cash')
    if not gold then return end 

    if choice.Name == "DialogChoice1" then --put the name of the dialog choice
            print("Choice1 Selected")
    end    

    if gold.Value >= 0 then -- If you have something more than dis then go down to the next line
        local model = game.ReplicatedStorage["SUCCESFULLBARGE-2"]:Clone()
        model.Parent = game.Workspace
        --model.PrimaryPart = game.Workspace["SUCCESFULLBARGE-2"].Union
        --model:SetPrimaryPartCFrame(CFrame.new(-578.621, -11.229, 50.79))
        --model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(0),0,0))  -- change devouring swarm to your weapon
        gold.Value = gold.Value - 5 -- Deduct the player's money
        print("Parsed Choice")
    end
end)

as you can see it has a lot of nonsense because i tried so many option's and different thing's from wiki's and other help questions. you can see when you click the dialog and choose an option no matter which option it should clone a model into the workspace.

This model is an Exact Replica from a model in the following picture.

https://imgur.com/fEcDEYh

The Selected Model is the Model which is about to be cloned. the model infront is the original model which acts like a boat.

now if you "buy" this model from the npc using the dialog the following happens.

https://imgur.com/IvUsfwr

the model Turns 90 degrees and Raises about 10 - 20 Studs!! this exact same problem occured when i scripted the boat control's to be more realistic and when the script contained problems/error's it does exact the same thing, It raises and turn's 90 Degrees. but the script in those model's are working correctly now.

Now i tried a lot if things ofcourse and i did found something interesting. i made a stud with a script which when you stand on it should also clone the model. and guess what, it clone's successfully into the workspace and it sails like the original model. i could say that the script for the NPC should be placed under the NPC like the stud so it would be loaded server sided. but it won't matter how you place the script or code it. it only show's this in the roblox output

print("Initiating Ship Broker Script") < the printed piece only ofcourse

so this means that the script is actually loaded, right ? so when i try the NPC now the script doesnt react to the choice's.

and this is the moment i need help.

Oh and the script under the NPC is a normal script. Yes i tried it using a Local script under NPC with no luck.

The script is now located As a Local Script under the StarterPack.

Answer this question