|
| 04 Apr 2016 02:29 PM |
Hello, I've been developing a very basic magic game recently. So far, what is supposed to happen is that when the player presses either 'E' or 'Q', a spell is performed. Both spells function perfectly when I test the game in Studio, or when I enter build mode - However, upon pressing play on the ROBLOX website, and joining the game, the spells no longer function. I honestly have no idea why this is happening, and would really appreciate help.
Here's a link to my game, which is uncopylocked for those who want to have a poke around; http://www.roblox.com/games/393772148/Magic-Testing
Thank you for your time, and I hope this problem can be quickly solved!
|
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 02:41 PM |
You have studio-syndrome. When you're in build or testing in play mode with studio you're both the server and client at the same time. Especially when using FE that will make you think you're replicating things properly. However when you play client and server are separated obviously and things tend to not work if you don't realize this when creating something. I couldn't tell you exactly where in your code the issue is occurring but I trust with a little logic and reasoning you'll be able to figure it out. Keep editing your code while using Test > Start, 1 player and 1 server. This will accurately mimic the actual environment as if you were just playing the game on the website because it separates the client and server into two instances and communicating via localhost (127.0.0.1)
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 04 Apr 2016 02:43 PM |
| Try :WaitForChild if you haven't already |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 02:44 PM |
I'll try it tomorrow, thank you! It's currently 8:44 P.M. here in England - And that's my Netflix time...
|
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 02:45 PM |
@eRanged is right, that's a common headache with the whole studio-syndrome thing - and I totally feel for the Netflix and chill. Cheers.
|
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 03:34 PM |
Cutting out of my Netflix time, I did as both of you said. I think I've found the problem, but it's a confusing one. I ran a server with one player, and then a server with two players, and both times the server output responded with the same message each time a player connected. In yellow text, the output read "Replication: Can't create default object of type Players". Is this a ROBLOX error, or am I just being stupid?
|
|
|
| Report Abuse |
|
|
|
| 04 Apr 2016 03:49 PM |
Never mind! I was a complete idiot, and put part of the spell inside ServerStorage, instead of ReplicatedStorage. Heh, thank you for pointing out WaitForChild(), otherwise I would have never figured this out!
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 04:47 AM |
Okay - I think I've been an idiot again. I'll start off by stating that the spells script is a local script inside of the StarterPack. So, upon running two clients and a server, I've noticed that only one player can use the spells, by which I mean when such player presses either "Q", or "E", the correct animation plays, and all of the required instances are created. However, when the other player attempts to perform this spell by pressing "Q" or "E", only the animation is played. No instances are made. This is causing even more confusion.
|
|
|
| Report Abuse |
|
|
error9999
|
  |
| Joined: 05 Sep 2009 |
| Total Posts: 1593 |
|
|
| 05 Apr 2016 04:50 AM |
Is it a local script? And does it use the localplayer's humanoid and?
Btw nice to see someone online at this forum at this time of the day :) |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 04:57 AM |
1) Yes, it's a local script. 2) Yes, it uses the localplayer's humanoid (I think. I'm relatively new to all of this.) 3) I'm British - It's 11AM here :P
The game; http://www.roblox.com/games/393772148/Magic-Testing
The game is uncopylocked if you wish to have a poke around. Thank you for you assistance!
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 05:05 AM |
Here's the script;
local BloodMagic = game.StarterPack:WaitForChild("Blood Magic") print(BloodMagic.Name, "has been added to the Starter Pack") local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Character = Player.Character or Player.CharacterAdded:wait() local canCast = true; local Shield = Instance.new("Animation") Shield.AnimationId = "http://www.roblox.com/Blood-Shield-V-1-item?id=385166396" local BloodStrike = Instance.new("Animation") BloodStrike.AnimationId = "http://www.roblox.com/item.aspx?id=393291451" local Flag = false;
Mouse.KeyDown:connect(function(Key) if Key == "q" and canCast then canCast = false; --Otherwise you would have ran into the ability to spam it and make lag-- local cframe = Player.Character.Torso.CFrame local ShieldTrack = Player.Character.Humanoid:LoadAnimation(Shield) ShieldTrack:Play() wait(1) local Shield = Instance.new("Part", Character) Shield.Size = Vector3.new(7,7,7) Shield.Shape = Enum.PartType.Ball Shield.Name = "Shield" Shield.CanCollide = false Shield.BrickColor = BrickColor.new("Dark red") Shield.Transparency = 0.25 Shield.TopSurface = Enum.SurfaceType.Smooth Shield.BottomSurface = Enum.SurfaceType.Smooth Shield:BreakJoints(); Shield.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0); Shield.CFrame = Character.Torso.CFrame; local Weld = Instance.new("Weld", Character) Weld.Part0 = Character.Torso Weld.Part1 = Shield Character.Humanoid.WalkSpeed = 0 wait(5) Character.Humanoid.WalkSpeed = 16 canCast = true --This will make it so they can do it again after 5 seconds, but you can make it less or more time. Shield:Destroy(); Weld:Destroy(); end if Key == "e" and canCast then canCast = false; local BStrikeTrack = Player.Character.Humanoid:LoadAnimation(BloodStrike) BStrikeTrack:Play() wait(1) Flag = true; Character.Humanoid.WalkSpeed = 0 local Strike = Instance.new("Part", Character) Strike.Size = Vector3.new(3,3,3) Strike.Name = "Strike" Strike.Shape = Enum.PartType.Ball Strike.CanCollide = false Strike.BrickColor = BrickColor.new("Dark red") Strike.TopSurface = Enum.SurfaceType.Smooth Strike.BottomSurface = Enum.SurfaceType.Smooth Strike.Transparency = 0.25 Strike:BreakJoints(); Strike.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0); local Weld = Instance.new("Weld", Strike) Weld.Part0 = Character["Left Arm"] Weld.Part1 = Strike Weld.C1 = CFrame.new(0, 2.5, 0) local bloodStrike = game.ReplicatedStorage.BloodStrike local BSCopy = bloodStrike:Clone() BSCopy.Parent = Strike BSCopy.Position = Strike.Position BSCopy.CFrame = CFrame.new(BSCopy.Position, Mouse.Hit.p) BSCopy.BodyVelocity.velocity = BSCopy.CFrame.lookVector * 120 BSCopy.Touched:connect(function(part) if Flag == true then local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Humanoid") end if humanoid then humanoid:TakeDamage(30) end end end) wait(5) canCast = true; Strike:Destroy(); Weld:Destroy(); wait(1) Character.Humanoid.WalkSpeed = 16 BSCopy:Destroy() end
end)
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 05 Apr 2016 05:36 AM |
Do you try summoning after the 5 seconds? Since its in a server script the 5 second denounce is for the whole sever so if player1 uses it player2 has to wait 5 seconds too |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 05 Apr 2016 05:37 AM |
| Wait is this a Module? I'm seeing local and server stuff mixed up |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 05:39 AM |
I'm unsure of what a Module is, so I'm going to say no, it isn't one. I'm very, so very new to this, and have basically stuck together whatever I thought might work. And with your previous reply, the problem is not that player 2 has to wait the 5 seconds player 1 does. The problem is player 2 cannot perform the spell at all, only the animation is played.
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 07:03 AM |
Just FYI don't worry about "Replication: Can't create default object of type Players" in the output. Not sure why it does that, but it's harmless, it's just Roblox being dumb as usual.
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 07:13 AM |
| Alright, thanks. I rewrote the script, and my problem's solved now. Thank you for your help, people. |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2016 09:03 AM |
*Large Sigh* I was wrong - The same problem is still happening. Only one play has the ability to use the spells. However, on the plus side, I made my script neat :D. This is an incredibly...odd...problem, and I hope the answer isn't something that's been staring me in the face.
Game Link; http://www.roblox.com/item.aspx?id=393772148
|
|
|
| Report Abuse |
|
|