RealistKJoin Date: 2011-02-20 Post Count: 3489 |
I am learning to script, and editing my RPG game but I have took a morph from free models, and when I be that morph, I can't buy any of my swords from the shop etc.
Can someone tell me how to make this script so I can actually buy things when I am in the morph?
This script is too advanced for me, if you also can tell me what you changed it would be amazing.
function getObject(className, part)
if part.className ~= className then
repeat
part = part.Parent
until part.className == className
end
return part
end
-- Index variables
goku = game.Lighting.Goku:Clone() -- You need the model, named "Goku", to be in game.Lighting
player = getObject("Player", script) -- Find the player
function doMorph(model) -- Named it doMorph, since I feel that's more of what it's doing
model.Torso.Anchored = true
hint = Instance.new("Hint", player)
for i=1,3 do
hint.Text = "Morphing, please wait"
for c=1,5 do
hint.Text = hint.Text, "."
wait(0.03)
end
end
hint.Parent = nil
model.Torso.Anchored = false
end
function morph()
repeat
-- Make sure the player didn't die
if player.Character == nil then
return nil
end
-- Now make sure player isn't already morphed
if player.Character:FindFirstChild("IsaDalek") then
return false -- I changed it, so it can show the error
end
-- Index new variables
newModel = goku:Clone() -- Clone the Goku model
parts = newModel:GetChildren() -- Get each of the parts
-- Unanchor each part, and make it collide with other parts
for i=1,#parts do
if parts[i].className == "Part" then
parts[i].Anchored = false
parts[i].CanCollide = true
end
end
-- Make the new model, and enable it to be the character
newModel.Parent = workspace
newModel:MakeJoints()
newModel.Name = "Goku ("..player.Name..")"
newModel.Controller = 7 -- Since this doesn't have the model itself, I'm unsure whether this is there. However,
-- it was in the previous script, so I'm including it.
until newModel.Humanoid.Health ~= 0 -- Don't clone if it died
player.Character = newModel -- Change the character
doMorph(newModel) -- Show the morphing hint
end
script.Parent.MouseButton1Down:connect(morph) |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
bump |
|
|
The problem is not in the morph script its on the touch script because the brick with touch script touches the morph not the player |
|
|
Do you use a touch script that puts gui shop on the player?
I made this one:
gui=LOCATION:Clone() <-- Location of the gui
function Touche(part)
--if player has morph--
if part.Parent:IsA("Model") then
h=part.Parent.Parent:FindFirstChild("Humanoid")
if h~=nil then
player=game.Players:GetPlayerFromCharacter(part.Parent.Parent)
gui.Parent=player.PlayerGui
--If player has no morph---
else if part.Parent:IsA("Model") then
h=part.Parent:FindFirstChild("Humanoid")
if h~=nil then
player=game.Players:GetPlayerFromCharacter(part.Parent)
gui.Parent=player.PlayerGui
end
end
end
end
end
script.Parent.Touched:connect(Touche) |
|
|
Sorry,
I fixed it:
gui=LOCATION:Clone()
function Touche(part)
if part.Parent:IsA("Model") then
h=part.Parent.Parent:FindFirstChild("Humanoid")
if h~=nil then
player=game.Players:GetPlayerFromCharacter(part.Parent.Parent)
gui.Parent=player.PlayerGui
else if part.Parent:IsA("Model") then
h=part.Parent:FindFirstChild("Humanoid")
if h~=nil then
player=game.Players:GetPlayerFromCharacter(part.Parent)
gui.Parent=player.PlayerGui
end
end
end
end
end
script.Parent.Touched:connect(Touche)
|
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
It doesn't put a shop GUI in the player, I don't really know what you mean with that but it just makes you the same person as the morph, so I think the leaderboard is not attached to you anymore or something.
I made the entire morph thing a model, would you maybe check it out and tell me what you changed? |
|
|
put the script i made in a part then change the "LOCATION" to the location of the GUI -_- |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
I get it but like I said, you just be the morph, you won't get a GUI in your screen. |
|
|
wiki.roblox.com/index.php?title=Scripting
googledrive.com/host/0BygQW0Uq8-q0eFY0UWpfbmJqR3M/index.html |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
Can you just tell me what I should do step by step..
I'm not a born scripter and I am trying to understand it but I you are confusing me with the GUI thing. |
|
|
thats why learn how to script..
make a gui put it on lighting
make a frame put in the gui
make a part anchored it
put the script in the part
change the "Location" in the script to gui's location
game.Lighting.gui
get a free model morph
wear it
or
just touch it dont get free model morphs
k.done |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
...?
I don't need a gui or anything, what is it supposed to do?
Just want it so if you step on the button, you will be that morph but you can still buy things. |
|
|
i was asking a question if you use shop gui -_- T
he morph script got no problem its the touch script
Know the basic instances and parts
Go: wiki.roblox.com/index.php?title=Scripting learn the basics -_- |
|
|
|
Don't use free models. Use magnitude. TADA! |
|
|
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
Do you mean the touch script of the things you can buy or the morph touch script?
If you mean the morph touch script then that one is in the model you took.
What can I change in that script? |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
? |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
bump |
|
|
This is why he couldn't help you. You are not listening -_-
Exactly what is the shop? A building? A GUI? A bunch of buttons?
How is the shop giving them items? Through touch? Through physical button clicking? Through gui button clicking? |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
Oh he was talking about a morph > shop or something I didn't understand it.
But no, the game: http://www.roblox.com/The-Assassins-Code-RPG-place?id=140680077
you might want to check it out to be sure.
If you have enough gold, you can go to the shop and step on the brick in front of the weapon displayed and just get it, no GUI, nothing.
Wearing a morph, if you step on the button to get the weapon then just nothing happens. |
|
|
Know the basic instances,seriously..
We can't help you if you don't know the basic instances
We can't help you if you don't know what is GUI
and
I already said the problem is not in the morph script its on the touch script
-_- |
|
RealistKJoin Date: 2011-02-20 Post Count: 3489 |
..
Ofc I know what a GUI is and for the 3rd time, the touch script is also in the model which you took, so you can help me. |
|
|
AND FOR THE 2ND TIME I SAID MAKE A PART
and put the script on that part |
|