of     1   

BIueguy195
#139334901Saturday, July 05, 2014 6:36 PM GMT

The part works but the message doesn't work. Output: 13:36:05.190 - Players.Player1.Backpack.Fishing Pole.Line:29: wrong number of arguments 13:36:05.190 - Script 'Players.Player1.Backpack.Fishing Pole.Line', Line 29 13:36:05.191 - Stack End ------------------------------------ local tool = script.Parent local user tool.Equipped:connect(function(mouse) user = tool.Parent mouse.Button1Down:connect(function() local ray = Ray.new(tool.ring.CFrame.p, (mouse.Hit.p - tool.ring.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) local distance = (position - tool.ring.CFrame.p).magnitude local rayPart = Instance.new("Part", user) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("Really Black") rayPart.Transparency = 0 rayPart.Anchored = true rayPart.CanCollide = true rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, tool.ring.CFrame.p) * CFrame.new(0, 0, -distance/2) m = Instance.new("Message") wait(3) user.RayPart:Destroy() m.Parent = game.Workspace m.Text = math.random("Hey", "Dude", "Sup") -- The problem is here end) end)
AnonyAnonymous
#139335100Saturday, July 05, 2014 6:38 PM GMT

Create a table containing the text as math.random is for numerical values.
domorox17
#139335101Saturday, July 05, 2014 6:38 PM GMT

Set the messages as a table, and do m.Text = tablename[math.random(1,#tablename)]
Frostglacier
#139335249Saturday, July 05, 2014 6:40 PM GMT

You're replacing number values with text. I'm sure you can use a table, but since I don't have much experience in that specific area of scripting you can do something like this: text = math.random(1,3) if text == 1 then m.Text = "Hey" elseif text == 2 then m.Text = "Dude" elseif text == 3 then m.Text = "Sup"
domorox17
#139335450Saturday, July 05, 2014 6:42 PM GMT

Mine should work fine....
BIueguy195
#139335466Saturday, July 05, 2014 6:42 PM GMT

Thanks! The tables worked. I guess I should have thought of that.
Frostglacier
#139335523Saturday, July 05, 2014 6:43 PM GMT

@Dom, I posted a bit late and didn't see the previous comments. Yours would work perfectly.
BIueguy195
#139335652Saturday, July 05, 2014 6:44 PM GMT

Frost would have worked just not as efficient.
BIueguy195
#139336094Saturday, July 05, 2014 6:48 PM GMT

Is there any way for there to be a harder chance to get one of the texts?
Frostglacier
#139336182Saturday, July 05, 2014 6:49 PM GMT

Increase the range of the math.random.
domorox17
#139336490Saturday, July 05, 2014 6:52 PM GMT

Or add ti the tabke and use mine :p
BIueguy195
#139336878Saturday, July 05, 2014 6:56 PM GMT

What?
BIueguy195
#139337488Saturday, July 05, 2014 7:02 PM GMT

Can you give me an example?
BIueguy195
#139338672Saturday, July 05, 2014 7:14 PM GMT

B
BIueguy195
#139339904Saturday, July 05, 2014 7:26 PM GMT

la la la
Frostglacier
#139339995Saturday, July 05, 2014 7:27 PM GMT

In my example, I used math.random(1,3). Changing this to something such as math.random(1,20) would decrease the probability of the text showing up.
BIueguy195
#139340440Saturday, July 05, 2014 7:32 PM GMT

fish = {"You caught a shark!", "You caught a pufferfish!", "You caught a clownfish!", "You caught a Go Fish!", "You caught a mackerel!", "You caught a JellyFish!"} local tool = script.Parent local user tool.Equipped:connect(function(mouse) user = tool.Parent mouse.Button1Down:connect(function() w = 1 if w == 1 then local ray = Ray.new(tool.ring.CFrame.p, (mouse.Hit.p - tool.ring.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) local distance = (position - tool.ring.CFrame.p).magnitude local rayPart = Instance.new("Part", user) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("Really Black") rayPart.Transparency = 0 rayPart.Anchored = true rayPart.CanCollide = true rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.2, 0.2, distance) rayPart.CFrame = CFrame.new(position, tool.ring.CFrame.p) * CFrame.new(0, 0, -distance/2) m = Instance.new("Message") wait(3) user.RayPart:Destroy() m.Parent = game.Workspace m.Text = fish[math.random(1, #fish)] wait(2) m:Destroy() w = 0 end end) end) So let's say I want Shark to be the least common. How would I do that?
Frostglacier
#139341264Saturday, July 05, 2014 7:41 PM GMT

I'm not sure how to edit this with your table format, but if you were to use my format as an example I would put ranges for each type of fish. Example (not functioning code at all): x = math.random(1,100) if x > 1 and x < 10 then sharkie elseif x > 11 and x < 40 then fishie elseif x > 41 and x < 80 then kapeesh
BIueguy195
#139341757Saturday, July 05, 2014 7:46 PM GMT

I'm sticking with tables, as they are more efficient

    of     1