|
| 01 Aug 2013 05:09 PM |
Whenever I throw this ball the game shuts down .-. local max_power=45;--the maximum amount of power that can be reached local deb=false;--is the mouse being held or not? local throwing=false;--is the ball being thrown or not? local power=0;--the current power being used local keys={};--table for keys being pressed
--associative array for background local frame_ary={ ['BackgroundColor3']=Color3.new(50/255,50/255,50/255); ['BackgroundTransparency']=0.1; ['BorderColor3']=Color3.new(1,1,1); ['Position']=UDim2.new(0.1,0,0.5,0); ['Size']=UDim2.new(0.025,0,0.3,0); };
--associative array for Instance type name function doit(array,name) local a=Instance.new(name); for i,v in pairs(array) do if pcall(function() return a[i]; end) then a[i]=v; end end return a; end
--throws the ball
--if the handle is touched while in handoff position script.Parent.Handle.Touched:connect(function(part) if keys['x'] and part.Parent:findFirstChild("Humanoid") then keys['x']=false; script.Parent.GripPos=Vector3.new(0.2,0.2,0.3); script.Parent.GripForward=Vector3.new(0.7688,0.4522,-0.4522); script.Parent.GripUp= Vector3.new(-0.5687,0.8068,-0.16); script.Parent.GripRight= Vector3.new(0.2925,0.3802,0.8774); script.Parent.Parent=part.Parent; end end );
--when the tool is equipped script.Parent.Equipped:connect(function(mouse) mouse.Icon = "rbxasset://textures\\GunCursor.png"; --when released mouse.Button1Up:connect(function() deb=false; end );
--when a key is pressed mouse.KeyDown:connect(function(key) keys[key]=true; --if handoff motion if key:lower()=="x" then while keys[key:lower()] do script.Parent.GripPos=Vector3.new(0,0.5,0); script.Parent.GripForward=Vector3.new(0,0,0); script.Parent.GripUp= Vector3.new(0,0,0); script.Parent.GripRight= Vector3.new(0,0,1); Wait(); end script.Parent.GripPos=Vector3.new(0.2,0.2,0.3); script.Parent.GripForward=Vector3.new(0.7688,0.4522,-0.4522); script.Parent.GripUp= Vector3.new(-0.5687,0.8068,-0.16); script.Parent.GripRight= Vector3.new(0.2925,0.3802,0.8774); end end );
--when a key is released mouse.KeyUp:connect(function(key) keys[key:lower()]=false; end ); end );
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 05:10 PM |
heres the other script
local Tool = script.Parent; local bodyp = Instance.new("BodyPosition") local targetPos = nil local lookAt = nil
enabled = true
function fire(v) if(Tool.Handle.FlyingSound.IsPlaying == false) then Tool.Handle.FlyingSound:Play() end
local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local missile = Tool.Handle
local spawnPos = vCharacter.PrimaryPart.Position
targetPos = spawnPos + (v * 200)
Tool.Parent = game.Workspace bodyp.maxForce = Vector3.new(1e3,1e3,1e3) bodyp.D = 1.5e3 bodyp.P = 1e3 bodyp.position = targetPos bodyp.Parent = missile wait(1)
bodyp.position = Vector3.new(targetPos.X,0,targetPos.Z) bodyp.D = 1.6e3 wait(1)
bodyp.Parent = Tool Tool.Handle.FlyingSound:Stop() end
function onActivated() if not enabled then return end
enabled = false
local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end
targetPos = humanoid.TargetPoint lookAt = (targetPos - character.Head.Position).unit fire(lookAt)
wait(1)
enabled = true
end
function onTouched(part) local h = part.Parent:FindFirstChild("Humanoid") if h ~= nil and Tool.Parent == game.Workspace then Tool.Handle.FlyingSound:Stop() bodyp.Parent = Tool --Tool.Parent = h.Parent end
end
Tool.Handle.Touched:connect(onTouched) script.Parent.Activated:connect(onActivated)
|
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 01 Aug 2013 05:13 PM |
| One thing I see is that you don't have a Button1Down event in there, to set deb to true. I'm still looking though. Check your loops thoroughly, make sure they are finite, and that they have wait()'s in them. I'm also unsure if the wait() function must be written all lowercase or if it can be capitalized like you have it. I don't think that matter would cause the game to crash by any means though. |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 01 Aug 2013 05:15 PM |
| Why'd you use semicolons in one script and not the other? |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Aug 2013 05:19 PM |
| This ball used to work fine, until the update last week. |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 01 Aug 2013 05:19 PM |
| How fluent are you in scripting? Did you understand the first reply I posted? |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 05:21 PM |
| I understood the second part but not the first one e.e |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 05:23 PM |
Heres another script this might answer ur question e.e
local Tool = script.Parent;
enabled = true function onButton1Down(mouse) if not enabled then return end
enabled = false mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
wait(1) mouse.Icon = "rbxasset://textures\\GunCursor.png" enabled = true
end
function onEquippedLocal(mouse)
if mouse == nil then print("Mouse not found") return end
mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end
Tool.Equipped:connect(onEquippedLocal)
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 05:23 PM |
Last one
local bodyp = script.Parent.BodyVelocity local connection = nil local power=tonumber(script.Name) or 0;
local sound = script.Parent.FlyingSound sound.Looped = true sound:Play()
function OnTouch(hit) bodyp:Remove() connection:disconnect() sound:Stop() end
connection = script.Parent.Touched:connect(OnTouch)
Wait(0.2) while bodyp do Wait() bodyp.velocity=bodyp.velocity-Vector3.new(0,1.75,0); end sound:Stop() game:GetService("Debris"):AddItem(script,0);
|
|
|
| Report Abuse |
|
|
| |
|