Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to edit Pre-Existing Script From Script?

First of all let me say I don't want a script, I need an explanation.

So The Roblox skateboards are great, and I'm trying to make a game featuring many different skateboards and skateboard effects.

The problem is, the way it works is it inserts it using a service and probably gets it from the website or something, And it makes a new one every time you place it down.

This is a problem because I can't really change anything about the skateboard.

If anyone has any idea how to do this, that would be fine.

If you want to see the script, here it is:

Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Mesh = Handle:WaitForChild("Mesh")

Drop = Handle:WaitForChild("Drop")

Players = game:GetService("Players")
InsertService = game:GetService("InsertService")

SkateboardId = 160740096

SkateboardModel = InsertService:LoadAsset(SkateboardId)

Skateboard = SkateboardModel:GetChildren()[1]:Clone()
Skateboard:WaitForChild("SkateboardPlatform"):WaitForChild("Mesh").TextureId = Mesh.TextureId

SkateboardModel:Destroy()

ToolData = Skateboard:WaitForChild("SkateboardPlatform"):WaitForChild("Tool")

ToolName = Instance.new("StringValue")
ToolName.Name = "ToolName"
ToolName.Value = Tool.Name
ToolName.Parent = ToolData

ToolIcon = Instance.new("StringValue")
ToolIcon.Name = "ToolIcon"
ToolIcon.Value = Tool.TextureId
ToolIcon.Parent = ToolData

ToolTip = Instance.new("StringValue")
ToolTip.Name = "ToolTip"
ToolTip.Value = Tool.ToolTip
ToolTip.Parent = ToolData

ToolGrip = Instance.new("CFrameValue")
ToolGrip.Name = "ToolGrip"
ToolGrip.Value = Tool.Grip
ToolGrip.Parent = ToolData

ToolTexture = Instance.new("StringValue")
ToolTexture.Name = "ToolTexture"
ToolTexture.Value = Mesh.TextureId
ToolTexture.Parent = ToolData

function TransformModel(Parent, NewCFrame)
	Parent:MoveTo(NewCFrame.p)
	local Origins = {}
	for i, v in pairs(Parent:GetChildren()) do
		if v:IsA("BasePart") then
			Origins[v] = Parent:GetModelCFrame():toObjectSpace(v.CFrame)
		end
	end
	for i, v in pairs(Origins) do
		i.CFrame = NewCFrame:toWorldSpace(v)
	end
end

function DropSkateboard()
	Drop:Play()
	
	for i, v in pairs(Skateboard:GetChildren()) do
		if v:IsA("BasePart") then
			v.Anchored = true
		end
	end
	
	InsertService:Insert(Skateboard)
	
	local SkateboardCFrame = Torso.CFrame + Torso.CFrame.lookVector * (((Torso.Size.Z / 2) + (Skateboard:GetModelSize().Z / 2)) * 1.5)
	local SkateboardAngle = CFrame.Angles(0, 0, 0)
	TransformModel(Skateboard, SkateboardCFrame * SkateboardAngle)
	Skateboard:MakeJoints()
	
	for i, v in pairs(Skateboard:GetChildren()) do
		if v:IsA("BasePart") then
			v.Velocity = Vector3.new(0, 0, 0)
			v.RotVelocity = Vector3.new(0, 0, 0)
			v.Anchored = false
		end
	end
	
	Tool:Destroy()	
	
end

function Equipped(Mouse)
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso")
	if not Character or not Humanoid or Humanoid.Health == 0 or not Torso then
		return
	end
	Mouse.Icon = "http://www.roblox.com/asset/?id=22858207"
	Mouse.Button1Down:connect(function()
		if Humanoid and Humanoid.Health > 0 and Torso then
			Mouse.Icon = ""
			DropSkateboard()
		end
	end)
end

Tool.Equipped:connect(Equipped)

1 answer

Well, you could test in studio, drop the skateboard, then copy it. then when you hit the stop button paste it into the workspace and edit it as much as you like.

If for some reason you can't do that then making your own skateboard is another option.

4 comments

0

The Skateboard in the backpack doesnt have any script but the script that drops it, then when I place it it appears in workspace with a lot of scripts. It does loadservice and gets a certain Item Id

0

Well if you can't figure out how to work around the dropped skateboard then I suggest making your own from scratch.

0

The reason I even made this page was because I can't figure out how to go around that. That's why I need other's help.

0

Well then I don't know what to tell you, do projects you're capable of doing. We'll help you but not do it for you.

This discussion is preserved as it was. New answers, comments, and votes are closed.